/
usr
/
lib64
/
python2.6
/
Demo
/
tkinter
/
matt
/
/usr/lib64/python2.6/Demo/tkinter/matt
mkdir
upload
Name
Size
Mode
Actions
00-HELLO-WORLD.py
724
0644
edit
dl
rm
00-HELLO-WORLD.pyc
1299
0644
edit
dl
rm
00-HELLO-WORLD.pyo
1299
0644
edit
dl
rm
animation-simple.py
939
0644
edit
dl
rm
animation-simple.pyc
1720
0644
edit
dl
rm
animation-simple.pyo
1720
0644
edit
dl
rm
animation-w-velocity-ctrl.py
1201
0644
edit
dl
rm
animation-w-velocity-ctrl.pyc
2027
0644
edit
dl
rm
animation-w-velocity-ctrl.pyo
2027
0644
edit
dl
rm
bind-w-mult-calls-p-type.py
1550
0644
edit
dl
rm
bind-w-mult-calls-p-type.pyc
1401
0644
edit
dl
rm
bind-w-mult-calls-p-type.pyo
1401
0644
edit
dl
rm
canvas-demo-simple.py
748
0644
edit
dl
rm
canvas-demo-simple.pyc
1421
0644
edit
dl
rm
canvas-demo-simple.pyo
1421
0644
edit
dl
rm
canvas-gridding.py
2271
0644
edit
dl
rm
canvas-gridding.pyc
2326
0644
edit
dl
rm
canvas-gridding.pyo
2326
0644
edit
dl
rm
canvas-moving-or-creating.py
2422
0644
edit
dl
rm
canvas-moving-or-creating.pyc
2585
0644
edit
dl
rm
canvas-moving-or-creating.pyo
2585
0644
edit
dl
rm
canvas-moving-w-mouse.py
2126
0644
edit
dl
rm
canvas-moving-w-mouse.pyc
2473
0644
edit
dl
rm
canvas-moving-w-mouse.pyo
2473
0644
edit
dl
rm
canvas-mult-item-sel.py
2841
0644
edit
dl
rm
canvas-mult-item-sel.pyc
2808
0644
edit
dl
rm
canvas-mult-item-sel.pyo
2808
0644
edit
dl
rm
canvas-reading-tag-info.py
1678
0644
edit
dl
rm
canvas-reading-tag-info.pyc
1860
0644
edit
dl
rm
canvas-reading-tag-info.pyo
1860
0644
edit
dl
rm
canvas-w-widget-draw-el.py
1178
0644
edit
dl
rm
canvas-w-widget-draw-el.pyc
1505
0644
edit
dl
rm
canvas-w-widget-draw-el.pyo
1505
0644
edit
dl
rm
canvas-with-scrollbars.py
2108
0644
edit
dl
rm
canvas-with-scrollbars.pyc
2363
0644
edit
dl
rm
canvas-with-scrollbars.pyo
2363
0644
edit
dl
rm
dialog-box.py
2440
0644
edit
dl
rm
dialog-box.pyc
1978
0644
edit
dl
rm
dialog-box.pyo
1978
0644
edit
dl
rm
entry-simple.py
729
0644
edit
dl
rm
entry-simple.pyc
1076
0644
edit
dl
rm
entry-simple.pyo
1076
0644
edit
dl
rm
entry-with-shared-variable.py
1747
0644
edit
dl
rm
entry-with-shared-variable.pyc
1640
0644
edit
dl
rm
entry-with-shared-variable.pyo
1640
0644
edit
dl
rm
killing-window-w-wm.py
1295
0644
edit
dl
rm
killing-window-w-wm.pyc
1493
0644
edit
dl
rm
killing-window-w-wm.pyo
1493
0644
edit
dl
rm
menu-all-types-of-entries.py
9110
0644
edit
dl
rm
menu-all-types-of-entries.pyc
4971
0644
edit
dl
rm
menu-all-types-of-entries.pyo
4971
0644
edit
dl
rm
menu-simple.py
3251
0644
edit
dl
rm
menu-simple.pyc
1961
0644
edit
dl
rm
menu-simple.pyo
1961
0644
edit
dl
rm
not-what-you-might-think-1.py
675
0644
edit
dl
rm
not-what-you-might-think-1.pyc
1300
0644
edit
dl
rm
not-what-you-might-think-1.pyo
1300
0644
edit
dl
rm
not-what-you-might-think-2.py
747
0644
edit
dl
rm
not-what-you-might-think-2.pyc
1335
0644
edit
dl
rm
not-what-you-might-think-2.pyo
1335
0644
edit
dl
rm
packer-and-placer-together.py
1209
0644
edit
dl
rm
packer-and-placer-together.pyc
1388
0644
edit
dl
rm
packer-and-placer-together.pyo
1388
0644
edit
dl
rm
packer-simple.py
819
0644
edit
dl
rm
packer-simple.pyc
1424
0644
edit
dl
rm
packer-simple.pyo
1424
0644
edit
dl
rm
placer-simple.py
1078
0644
edit
dl
rm
placer-simple.pyc
1293
0644
edit
dl
rm
placer-simple.pyo
1293
0644
edit
dl
rm
pong-demo-1.py
1549
0644
edit
dl
rm
pong-demo-1.pyc
2134
0644
edit
dl
rm
pong-demo-1.pyo
2134
0644
edit
dl
rm
printing-coords-of-items.py
2400
0644
edit
dl
rm
printing-coords-of-items.pyc
2584
0644
edit
dl
rm
printing-coords-of-items.pyo
2584
0644
edit
dl
rm
radiobutton-simple.py
2011
0644
edit
dl
rm
radiobutton-simple.pyc
1864
0644
edit
dl
rm
radiobutton-simple.pyo
1864
0644
edit
dl
rm
README
513
0644
edit
dl
rm
rubber-band-box-demo-1.py
2134
0644
edit
dl
rm
rubber-band-box-demo-1.pyc
2572
0644
edit
dl
rm
rubber-band-box-demo-1.pyo
2572
0644
edit
dl
rm
rubber-line-demo-1.py
1919
0644
edit
dl
rm
rubber-line-demo-1.pyc
2276
0644
edit
dl
rm
rubber-line-demo-1.pyo
2276
0644
edit
dl
rm
slider-demo-1.py
1000
0644
edit
dl
rm
slider-demo-1.pyc
1712
0644
edit
dl
rm
slider-demo-1.pyo
1712
0644
edit
dl
rm
subclass-existing-widgets.py
677
0644
edit
dl
rm
subclass-existing-widgets.pyc
1234
0644
edit
dl
rm
subclass-existing-widgets.pyo
1234
0644
edit
dl
rm
two-radio-groups.py
3758
0644
edit
dl
rm
two-radio-groups.pyc
2192
0644
edit
dl
rm
two-radio-groups.pyo
2192
0644
edit
dl
rm
window-creation-more.py
1020
0644
edit
dl
rm
window-creation-more.pyc
1719
0644
edit
dl
rm
window-creation-more.pyo
1719
0644
edit
dl
rm
window-creation-simple.py
815
0644
edit
dl
rm
window-creation-simple.pyc
1642
0644
edit
dl
rm
window-creation-simple.pyo
1642
0644
edit
dl
rm
window-creation-w-location.py
1325
0644
edit
dl
rm
window-creation-w-location.pyc
2104
0644
edit
dl
rm
window-creation-w-location.pyo
2104
0644
edit
dl
rm
Edit:
/usr/lib64/python2.6/Demo/tkinter/matt/rubber-line-demo-1.py
(1919B)
from Tkinter import * class Test(Frame): def printit(self): print "hi" def createWidgets(self): self.QUIT = Button(self, text='QUIT', background='red', foreground='white', height=3, command=self.quit) self.QUIT.pack(side=BOTTOM, fill=BOTH) self.canvasObject = Canvas(self, width="5i", height="5i") self.canvasObject.pack(side=LEFT) def mouseDown(self, event): # canvas x and y take the screen coords from the event and translate # them into the coordinate system of the canvas object self.startx = self.canvasObject.canvasx(event.x) self.starty = self.canvasObject.canvasy(event.y) def mouseMotion(self, event): # canvas x and y take the screen coords from the event and translate # them into the coordinate system of the canvas object x = self.canvasObject.canvasx(event.x) y = self.canvasObject.canvasy(event.y) if (self.startx != event.x) and (self.starty != event.y) : self.canvasObject.delete(self.rubberbandLine) self.rubberbandLine = self.canvasObject.create_line( self.startx, self.starty, x, y) # this flushes the output, making sure that # the rectangle makes it to the screen # before the next event is handled self.update_idletasks() def __init__(self, master=None): Frame.__init__(self, master) Pack.config(self) self.createWidgets() # this is a "tagOrId" for the rectangle we draw on the canvas self.rubberbandLine = None Widget.bind(self.canvasObject, "<Button-1>", self.mouseDown) Widget.bind(self.canvasObject, "<Button1-Motion>", self.mouseMotion) test = Test() test.mainloop()
Save
cmd:
run