3 # this file demonstrates the creation of widgets as part of a canvas object
9 def createWidgets(self
):
10 self
.QUIT
= Button(self
, text
='QUIT', foreground
='red',
12 self
.QUIT
.pack(side
=BOTTOM
, fill
=BOTH
)
14 self
.draw
= Canvas(self
, width
="5i", height
="5i")
16 self
.button
= Button(self
, text
="this is a button",
19 # note here the coords are given in pixels (form the
20 # upper right and corner of the window, as usual for X)
21 # but might just have well been given in inches or points or
22 # whatever...use the "anchor" option to control what point of the
23 # widget (in this case the button) gets mapped to the given x, y.
24 # you can specify corners, edges, center, etc...
25 self
.draw
.create_window(300, 300, window
=self
.button
)
27 self
.draw
.pack(side
=LEFT
)
29 def __init__(self
, master
=None):
30 Frame
.__init
__(self
, master
)