I was looking through the graphics.py file and noticed two instances of justify, but I have never found any instructions on how to use it. All text seemed to be centered when used, I wanted to be able to justify left and right. Maybe I missed it somewhere. Any ideas if there is a command for it?
class Text(GraphicsObject):
def __init__(self, p, text):
GraphicsObject.__init__(self, ["justify","fill","text","font"])
self.setText(text)
self.anchor = p.clone()
self.setFill(DEFAULT_CONFIG['outline'])
self.setOutline = self.setFill
and
# Default values for various item configuration options. Only a subset of
# keys may be present in the configuration dictionary for a given item
DEFAULT_CONFIG = {"fill":"",
"outline":"black",
"width":"1",
"arrow":"none",
"text":"",
"justify":"center",
"font": ("helvetica", 12, "normal")}
The
Text
class appears to be missing thesetJustify()
method. We can define it and simply call it on ourText
instance: