[wxPython-users] how to scroll wx.Window horizontally?
Robin Dunn
robin at alldunn.com
Wed Jan 2 16:55:15 PST 2008
Pan Xingzhi wrote:
> Robin,
>
> Nice to hear from you again in 2008. Thank you for the direction.
>
> I kept asking questions about scrolling because I feel that
> scrolling in wxPython is a little bit weird, but to accomplish my task
> I have to thoroughly understand what's going on. There is something
> unusual but I couldn't tell, until I took some time to think about it,
> inside and out. Then I realized that in wxPython, both containers and
> non-containers can have scrolling ability (though it seems that
> wxPython do not emphasize the difference between the two). So my
> questions came again. I put my understandings below, please correct me
> if I'm wrong:
>
> 1. For non-container widgets like wx.TreeCtrl, by default,
> scrollbars show up when the virtual size gets larger than the client
> size.
Yes, in general. More specifically, widgets like this manage their own
scrollbars internally, and wx doesn't really have access to them[*].
The can be considered as an implementation detail that just happens to
be used inside the "black box" that is the widget.
[*] The exception of course is if the widget is implemented generically
using wx itself, but you can't depend on that because for a particular
widget it may be native on some platforms and generic on others.
> 2. The virtual size of non-containers is decided by the content of
> the non-container widget, e.g., the text in the TextCtrl, items in a
> TreeCtrl.
Yes.
> 3. For containers, the virtual size is calculated from the size
> (*not* virtual size) and position of its children (suppose we don't
> use sizers).
No. You need to explicitly set the virtual size, although sizers can be
used to help with this.
> 4. The condition for scrollbars of containers to show up is the
> same as non-containers.
Scrollbars will be shown if the virtual size is greater than the client
size.
>
> Btw, you guys really should rename wx.ScrolledWindow to
> ScrolledPanel or something. After all it's a container. A beginner
> would easily think ScrolledWIndow as a direct child of wx.Window.
> (However I found a wx.lib.scrolledpanel.ScrolledPanel already occupied
> the name.)
Yep, this was discussed in the past, but nothing was done because there
wasn't a clean migration path that made sense that would also preserve
backwards compatibility.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list