[wxPython-users] how to scroll wx.Window horizontally?
Pan Xingzhi
vengeance.storm at gmail.com
Tue Jan 1 09:30:08 PST 2008
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.
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.
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).
4. The condition for scrollbars of containers to show up is the
same as non-containers.
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.)
Cheers,
Pan Xingzhi
2008/1/1, Robin Dunn <robin at alldunn.com>:
> Pan Xingzhi wrote:
> > Hi,
> >
> > wx.Window has methods to scroll vertically (ScrollLines,
> > ScrollPages, etc.) but what if I want to scroll it horizontally? Do I
> > have to use wx.Window.ScrollWindow (and in pixels)?
>
>
> Yes, but it's easy to determine how many pixels there are in the
> horizontal equivalent to line or page, (based on whatever you set the
> scroll units to be) and I think you'll also need to update the scrollbar
> yourself as ScrollWindow just moves the pixels.
>
> >
> > I'm still confused about the real differences between normal
> > descents of wx.Window and wx.ScrolledWindow. Is there any situation
> > when I have to use the latter?
>
> wx.ScrolledWindow automates most of the ugly details of supporting a
> scrollable panel. That includes dealing with the virtual size vs.
> client size, positioning scroll bars, offsetting the drawing to the
> logical position, repositioning child widgets, etc. etc. About the only
> time you would want to deal with scrolling without a wx.ScrolledWindow
> is when you want more flexibility than what wx.ScrolledWindow can give
> you, which hasn't been very often in my experience.
>
>
> > Plus, I'd appreciate if people can give
> > me some help on the relationship between scrollbars/client
> > area/size/virtual size...
>
> http://wiki.wxpython.org/WindowSizeInfo
>
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org Java give you jitters? Relax with wxPython!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
More information about the wxpython-users
mailing list