views:

40

answers:

1

I add dinamically images to wx.ScrolledPanel. I add them sizer which is inside ScrolledPanel. I want to scroll ScrollBar automatically to the end. It is possible? I've read that

self.scroll.SetupScrolling(scroll_x=True, scroll_y=False, scrollToTop=False)

can resolve this problem, but in my application it doesn't work.

Scrolled Panel definition:

self.scroll = scrolled.ScrolledPanel(self, id = -1, pos = wx.DefaultPosition, size = (510, 200), style = wx.SUNKEN_BORDER)
self.sizer.Add(self.scroll)  

Add elements to them:

self.scroll.SetSizer(self.hbox )
self.scroll.SetAutoLayout(1) 

self.scroll.SetupScrolling(scrollToTop=False)
self.scroll.FitInside()
self.SetSizerAndFit(self.sizer)
self.Refresh()  
self.Layout()

Scroll automatically return to the left (begin of my image's list).. Anyone help?

+1  A: 
self.Scroll(self.GetClientSize()[0], -1)

clientSize is a tuple (x, y) of the widget's size and -1 specifies to not make any changes across the Y direction.

Steven Sproat
in my example it is self.scroll.Scroll(..) . Thanks ;)
Carolus89