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',
12 'command': self
.quit
})
13 self
.QUIT
.pack({'side': 'bottom', 'fill': 'both'})
15 self
.draw
= Canvas(self
, {"width" : "5i", "height" : "5i"})
17 self
.button
= Button(self
, {"text" : "this is a button",
18 "command" : self
.printhi
})
20 # note here the coords are given in pixels (form the
21 # upper right and corner of the window, as usual for X)
22 # but might just have well been given in inches or points or
23 # whatever...use the "anchor" option to control what point of the
24 # widget (in this case the button) gets mapped to the given x, y.
25 # you can specify corners, edges, center, etc...
26 self
.draw
.create_window(300, 300, {"window" : self
.button
})
28 self
.draw
.pack({'side': 'left'})
32 def __init__(self
, master
=None):
33 Frame
.__init
__(self
, master
)