[wxPython-users] scrolledPanel - controlling the scrollbar.

Robin Dunn robin at alldunn.com
Sun Dec 3 16:27:03 PST 2006


Donn Ingle wrote:
> Hello all,
> Thanks for all the help with my wee app so far. I have crossed-off so many
> little problems with the help of the good people on this list and the hard
> work that has gone into the wxPython demo.
> 
> I am using the wx.lib.scrolledpanel.ScrolledPanel for a control that draws
> fonts down its length. After a while a scrollbar appears, which is correct.
> 
> When the user is viewing a font waaaay down the list (they have scrolled)
> and they choose it (click) then press another button - the app does stuff
> and this results in the panel having to be entirely redrawn. (objects
> destroyed and re-created)
> 
> Now, that presents the user with the same list of fonts, but where they were
> looking only a moment before has been disrupted by the abrupt shift of the
> view back to the top.
> 
> Is there some way I can record the position of the scrollbar

	xPos, yPos = sp.GetViewStart()


> and then
> restore the wx.lib.scrolledpanel.ScrolledPanel to the same position it was
> in before I had to re-draw it?

	sp.Scroll(xPos, yPos)


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list