How to put a scrollbar to a frame?
Matthew Dixon Cowles
matt at mondoinfo.com
Tue Jun 5 13:27:34 EDT 2001
On Tue, 5 Jun 2001 10:06:50 -0400, JAY <lijil at nortelnetworks.com>
wrote:
>Hi there,
Hi!
>I am pretty new to python. My python script makes a frame in a widget
>to display some messages (UNIX system), it works fine. However, if
>the message gets too long, the frame will be extended and make the
>whole widget bigger than screen.
>To solve the problem, I want to put a scrollbar to the frame for the
>messages so that it's size won't change. But I don't know how. Could
>anybody tell me how to do it?
Scrolling a frame is a bit of a nuisance because frames don't have the
necessary scrolling methods to start out with the way that canvases,
for example, do. It's perfectly possible to do but requires a bit of
work. Happily, you don't have to do the work because Greg McFarlane
already has. His Pmw (Python megawidgets) is very handy. It's at:
http://pmw.sourceforge.net/
It includes useful widgets such as ScrolledFrame, ScrolledText, and a
bunch of others. Another handy thing (though not directly related to
your question) is Fredrik Lundh's An Introduction to Tkinter. It's at:
http://www.pythonware.com/library/tkinter/introduction/index.htm
Between the two, they make Tkinter programming much easier. If I had
a bunch of messages to display, I'd look at sticking them in a
Pmw.ScrolledText and plan to live happily ever after.
Regards,
Matt
More information about the Python-list
mailing list