[Tkinter-discuss] When to use a Canvas vs. a Frame from a container perspective?

python at bdurham.com python at bdurham.com
Fri Dec 17 18:52:19 CET 2010


This question is related to using Canvases and Frames as
containers and does not consider the drawing capabilities of the
Canvas widget.

Canvas and Frames are both containers. My understanding is that
both of these containers provide identical layout behaviors via
their pack, grid, and place methods (is this really true?). In
other words, I should be able to replace a Frame with a Canvas
and have identical behavior, correct?

>From a container perspective, would it be correct to describe a
Canvas as an enhanced Frame with the following capabilities?

- the ability to support virtual sizes greater than the visible
display area
- the scrollbar, scroll and viewport features associated with
having a larger virtual display area

One of my points of confusion with Canvas containers is figuring
out what techniques to use for the layout of traditional widgets.
Can I use regular pack and grid placement always, only when a
canvas does not have scrolling, or never? When should one use the
create_window() technique for widget placement?

Thank you,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101217/b312629c/attachment.html>


More information about the Tkinter-discuss mailing list