tkinter urgent help request

Eric Brunel eric.brunel at pragmadev.com
Tue Jun 24 12:53:52 EDT 2003


Martin Franklin wrote:
> You just tried to pack the scrollbar inside a Canvas widget.  The 
> scrollbar needs to be in the
> root widget I would think :-)
> 
>    scroll = Scrollbar(root)
>    scroll.pack(side=RIGHT,expand=1,fill=BOTH)

Well spotted Martin: I didn't see this one...

The funniest thing is that it actually works (well, at least using a canvas 
window instead of packing):

----------------------------
from Tkinter import *

root = Tk()

cnv = Canvas(root, width=400, height=400)
cnv.pack(fill=BOTH,expand=1)

scroll = Scrollbar(cnv, command=cnv.xview, orient=HORIZONTAL)
cnv.create_window(200, 400, anchor=S, window=scroll, width=400)
cnv.configure(xscrollcommand=scroll.set, scrollregion=(0, 0, 1000, 1000))

root.mainloop()
----------------------------

One of the most useless script I ever wrote... Sorry: it's a bit late here...
-- 
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com





More information about the Python-list mailing list