Submit
Path:
~
/
/
usr
/
lib64
/
python2.7
/
Demo
/
tkinter
/
matt
/
File Content:
canvas-with-scrollbars.py
from Tkinter import * # This example program creates a scroling canvas, and demonstrates # how to tie scrollbars and canvses together. The mechanism # is analogus for listboxes and other widgets with # "xscroll" and "yscroll" configuration options. class Test(Frame): def printit(self): print "hi" def createWidgets(self): self.question = Label(self, text="Can Find The BLUE Square??????") self.question.pack() self.QUIT = Button(self, text='QUIT', background='red', height=3, command=self.quit) self.QUIT.pack(side=BOTTOM, fill=BOTH) spacer = Frame(self, height="0.25i") spacer.pack(side=BOTTOM) # notice that the scroll region (20" x 20") is larger than # displayed size of the widget (5" x 5") self.draw = Canvas(self, width="5i", height="5i", background="white", scrollregion=(0, 0, "20i", "20i")) self.draw.scrollX = Scrollbar(self, orient=HORIZONTAL) self.draw.scrollY = Scrollbar(self, orient=VERTICAL) # now tie the three together. This is standard boilerplate text self.draw['xscrollcommand'] = self.draw.scrollX.set self.draw['yscrollcommand'] = self.draw.scrollY.set self.draw.scrollX['command'] = self.draw.xview self.draw.scrollY['command'] = self.draw.yview # draw something. Note that the first square # is visible, but you need to scroll to see the second one. self.draw.create_rectangle(0, 0, "3.5i", "3.5i", fill="black") self.draw.create_rectangle("10i", "10i", "13.5i", "13.5i", fill="blue") # pack 'em up self.draw.scrollX.pack(side=BOTTOM, fill=X) self.draw.scrollY.pack(side=RIGHT, fill=Y) self.draw.pack(side=LEFT) def scrollCanvasX(self, *args): print "scrolling", args print self.draw.scrollX.get() def __init__(self, master=None): Frame.__init__(self, master) Pack.config(self) self.createWidgets() test = Test() test.mainloop()
Submit
FILE
FOLDER
Name
Size
Permission
Action
00-HELLO-WORLD.py
724 bytes
0644
00-HELLO-WORLD.pyc
1299 bytes
0644
00-HELLO-WORLD.pyo
1299 bytes
0644
README
513 bytes
0644
animation-simple.py
939 bytes
0644
animation-simple.pyc
1720 bytes
0644
animation-simple.pyo
1720 bytes
0644
animation-w-velocity-ctrl.py
1201 bytes
0644
animation-w-velocity-ctrl.pyc
2027 bytes
0644
animation-w-velocity-ctrl.pyo
2027 bytes
0644
bind-w-mult-calls-p-type.py
1550 bytes
0644
bind-w-mult-calls-p-type.pyc
1401 bytes
0644
bind-w-mult-calls-p-type.pyo
1401 bytes
0644
canvas-demo-simple.py
748 bytes
0644
canvas-demo-simple.pyc
1421 bytes
0644
canvas-demo-simple.pyo
1421 bytes
0644
canvas-gridding.py
2271 bytes
0644
canvas-gridding.pyc
2323 bytes
0644
canvas-gridding.pyo
2323 bytes
0644
canvas-moving-or-creating.py
2422 bytes
0644
canvas-moving-or-creating.pyc
2583 bytes
0644
canvas-moving-or-creating.pyo
2583 bytes
0644
canvas-moving-w-mouse.py
2126 bytes
0644
canvas-moving-w-mouse.pyc
2473 bytes
0644
canvas-moving-w-mouse.pyo
2473 bytes
0644
canvas-mult-item-sel.py
2841 bytes
0644
canvas-mult-item-sel.pyc
2806 bytes
0644
canvas-mult-item-sel.pyo
2806 bytes
0644
canvas-reading-tag-info.py
1678 bytes
0644
canvas-reading-tag-info.pyc
1860 bytes
0644
canvas-reading-tag-info.pyo
1860 bytes
0644
canvas-w-widget-draw-el.py
1178 bytes
0644
canvas-w-widget-draw-el.pyc
1505 bytes
0644
canvas-w-widget-draw-el.pyo
1505 bytes
0644
canvas-with-scrollbars.py
2108 bytes
0644
canvas-with-scrollbars.pyc
2363 bytes
0644
canvas-with-scrollbars.pyo
2363 bytes
0644
dialog-box.py
2440 bytes
0644
dialog-box.pyc
1981 bytes
0644
dialog-box.pyo
1981 bytes
0644
entry-simple.py
729 bytes
0644
entry-simple.pyc
1076 bytes
0644
entry-simple.pyo
1076 bytes
0644
entry-with-shared-variable.py
1747 bytes
0644
entry-with-shared-variable.pyc
1640 bytes
0644
entry-with-shared-variable.pyo
1640 bytes
0644
killing-window-w-wm.py
1295 bytes
0644
killing-window-w-wm.pyc
1493 bytes
0644
killing-window-w-wm.pyo
1493 bytes
0644
menu-all-types-of-entries.py
9110 bytes
0644
menu-all-types-of-entries.pyc
4971 bytes
0644
menu-all-types-of-entries.pyo
4971 bytes
0644
menu-simple.py
3251 bytes
0644
menu-simple.pyc
1961 bytes
0644
menu-simple.pyo
1961 bytes
0644
not-what-you-might-think-1.py
675 bytes
0644
not-what-you-might-think-1.pyc
1300 bytes
0644
not-what-you-might-think-1.pyo
1300 bytes
0644
not-what-you-might-think-2.py
747 bytes
0644
not-what-you-might-think-2.pyc
1335 bytes
0644
not-what-you-might-think-2.pyo
1335 bytes
0644
packer-and-placer-together.py
1209 bytes
0644
packer-and-placer-together.pyc
1388 bytes
0644
packer-and-placer-together.pyo
1388 bytes
0644
packer-simple.py
819 bytes
0644
packer-simple.pyc
1424 bytes
0644
packer-simple.pyo
1424 bytes
0644
placer-simple.py
1078 bytes
0644
placer-simple.pyc
1293 bytes
0644
placer-simple.pyo
1293 bytes
0644
pong-demo-1.py
1549 bytes
0644
pong-demo-1.pyc
2128 bytes
0644
pong-demo-1.pyo
2128 bytes
0644
printing-coords-of-items.py
2400 bytes
0644
printing-coords-of-items.pyc
2582 bytes
0644
printing-coords-of-items.pyo
2582 bytes
0644
radiobutton-simple.py
2011 bytes
0644
radiobutton-simple.pyc
1864 bytes
0644
radiobutton-simple.pyo
1864 bytes
0644
rubber-band-box-demo-1.py
2134 bytes
0644
rubber-band-box-demo-1.pyc
2569 bytes
0644
rubber-band-box-demo-1.pyo
2569 bytes
0644
rubber-line-demo-1.py
1919 bytes
0644
rubber-line-demo-1.pyc
2273 bytes
0644
rubber-line-demo-1.pyo
2273 bytes
0644
slider-demo-1.py
1000 bytes
0644
slider-demo-1.pyc
1712 bytes
0644
slider-demo-1.pyo
1712 bytes
0644
subclass-existing-widgets.py
677 bytes
0644
subclass-existing-widgets.pyc
1234 bytes
0644
subclass-existing-widgets.pyo
1234 bytes
0644
two-radio-groups.py
3758 bytes
0644
two-radio-groups.pyc
2192 bytes
0644
two-radio-groups.pyo
2192 bytes
0644
window-creation-more.py
1020 bytes
0644
window-creation-more.pyc
1719 bytes
0644
window-creation-more.pyo
1719 bytes
0644
window-creation-simple.py
815 bytes
0644
window-creation-simple.pyc
1642 bytes
0644
window-creation-simple.pyo
1642 bytes
0644
window-creation-w-location.py
1325 bytes
0644
window-creation-w-location.pyc
2100 bytes
0644
window-creation-w-location.pyo
2100 bytes
0644
N4ST4R_ID | Naxtarrr