[Tkinter-discuss] Scrolling canvas (Including all widgets on it)

Guilherme Polo ggpolo at gmail.com
Sat Jan 10 03:58:08 CET 2009


On Fri, Jan 9, 2009 at 7:37 AM, Guilherme Polo <ggpolo at gmail.com> wrote:
> On Thu, Jan 8, 2009 at 11:28 PM, waffles123
> <drunkenmousehide at hotmail.com> wrote:
>>
>> I'm trying to make a canvas scrollable, but the problem is I can only get
>> things that I've drawn, or what not on the canvas to move. I want to be able
>> to move every widget (In this case, 70 odd entry boxes, and a few labels)
>>
>> The full code is http://www.nomorepasting.com/getpaste.php?pasteid=23309
>
> To get a scrollable canvas you will need to apply several tricks to
> it. I would start suggesting by embedding a single frame at position
> 0, 0 on it, and then create all the other widgets using this frame as
> the parent. Next you will need to wait the widgets appear (with
> wait_visibility) and then adjust the scrollregion of the Canvas, as
> well its width to something reasonable, and possibly how much the
> scrollbars scrolls.
>
> I'm leaving only the tips right now because I'm leaving right now.
> Nevertheless, you can find several implementations of those through
> Google.

I've just added a simple ScrolledFrame to
http://tkinter.unpythonic.net/wiki/ScrolledFrame

Don't be surprised if it doesn't work for you, it contains several
bugs in different categories :)
Improvements over time are likely to happen, especially if someone uses it.

-- 
-- Guilherme H. Polo Goncalves


More information about the Tkinter-discuss mailing list