8 def createWidgets(self
):
9 self
.QUIT
= Button(self
, text
='QUIT', foreground
='red',
11 self
.QUIT
.pack(side
=BOTTOM
, fill
=BOTH
)
13 self
.drawing
= Canvas(self
, width
="5i", height
="5i")
16 pgon
= self
.drawing
.create_polygon(
17 10, 10, 110, 10, 110, 110, 10 , 110,
18 fill
="red", tags
=("weee", "foo", "groo"))
20 # this is how you query an object for its attributes
21 # config options FOR CANVAS ITEMS always come back in tuples of length 5.
27 # the blank spots are for consistency with the config command that
28 # is used for widgets. (remember, this is for ITEMS drawn
29 # on a canvas widget, not widgets)
30 option_value
= self
.drawing
.itemconfig(pgon
, "stipple")
31 print "pgon's current stipple value is -->", option_value
[4], "<--"
32 option_value
= self
.drawing
.itemconfig(pgon
, "fill")
33 print "pgon's current fill value is -->", option_value
[4], "<--"
34 print " when he is usually colored -->", option_value
[3], "<--"
36 ## here we print out all the tags associated with this object
37 option_value
= self
.drawing
.itemconfig(pgon
, "tags")
38 print "pgon's tags are", option_value
[4]
40 self
.drawing
.pack(side
=LEFT
)
42 def __init__(self
, master
=None):
43 Frame
.__init
__(self
, master
)