3 # this is the same as simple-demo-1.py, but uses
5 # note that there is no explicit call to start Tk.
6 # Tkinter is smart enough to start the system if it's not already going.
13 def createWidgets(self
):
14 self
.QUIT
= Button(self
, text
='QUIT', foreground
='red',
16 self
.QUIT
.pack(side
=BOTTOM
, fill
=BOTH
)
18 self
.draw
= Canvas(self
, width
="5i", height
="5i")
20 self
.speed
= Scale(self
, orient
=HORIZONTAL
, from_
=-100, to
=100)
22 self
.speed
.pack(side
=BOTTOM
, fill
=X
)
25 self
.draw
.create_rectangle(0, 0, 10, 10, tags
="thing", fill
="blue")
26 self
.draw
.pack(side
=LEFT
)
28 def moveThing(self
, *args
):
29 velocity
= self
.speed
.get()
30 str = float(velocity
) / 1000.0
32 self
.draw
.move("thing", str, str)
33 self
.after(10, self
.moveThing
)
35 def __init__(self
, master
=None):
36 Frame
.__init
__(self
, master
)
39 self
.after(10, self
.moveThing
)