ScrolledPanel and repaint issues...
A.M.
cuberootva at gmail.com
Thu Aug 10 11:08:26 PDT 2006
Hello all,
Below you will find a test case that exhibits some weird behaviour. There
are a couple of issues that I would like to get some guidance on.
NOTE...the first issue only occurs on Windows for me. Linux works fine.
First, when the SHOW_PROGRESS flag is true a progress dialog will be
presented and destroyed which causes my ScrolledPanel that contains 10 lines
of text to be drawn oddly in the upper-left portion of the main
ScrolledPanel. Resizing this Frame will cause things to snap back to normal.
Now, if you set the flag to false everything works fine. Any ideas or
suggestions?
The second issue is the difference in behaviour between Windows and Linux.
In Linux, if you shrink the Frame the inner ScrolledPanel does not resize
properly and scrollbars are hidden by the Frame. In Windows it resizes the
way I expect it to. Regardless of which behaviour is correct, the two are
different. Is this behaviour documented and/or expected? It doesn't exactly
seem cross-platform to me...
Thanks,
AM
# BEGIN CODE
import wx
import wx.lib.scrolledpanel as ScrolledPanel
SHOW_PROGRESS =3D 1
class TestFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=3Dtitle, style=3D
wx.DEFAULT_FRAME_STYLE|wx.CENTRE)
size =3D self.GetClientSize()
self._panel =3D ScrolledPanel.ScrolledPanel(self, -1, size=3Dsize,
style=3Dwx.SUNKEN_BORDER)
self._sizer =3D wx.BoxSizer(wx.VERTICAL)
self._panel.SetSizer(self._sizer)
self._panel.SetupScrolling()
sp =3D ScrolledPanel.ScrolledPanel(self._panel, -1, size=3D(-1,100),
style=3Dwx.SUNKEN_BORDER)
spsizer =3D wx.BoxSizer(wx.VERTICAL)
sp.SetSizer(spsizer)
sp.SetupScrolling()
# this does not need to be a progress dialog. it has the same
behaviour with a message dialog
if SHOW_PROGRESS:
pd =3D wx.ProgressDialog("Fooooo", "Barrrr", maximum=3D10,
style=3D
wx.PD_APP_MODAL|wx.PD_ELAPSED_TIME|wx.PD_ESTIMATED_TIME|wx.PD_REMAINING_TIM=
E|wx.PD_AUTO_HIDE
)
v =3D 0
for i in xrange(10):
spsizer.Add(wx.StaticText(sp, wx.ID_ANY, "Whatever goes here!"),
flag=3Dwx.EXPAND|wx.ALL)
v +=3D 1
if SHOW_PROGRESS:
pd.Update(v)
if SHOW_PROGRESS:
pd.Destroy()
self._sizer.Add(sp, 0, wx.EXPAND)
self.Center()
self.Show(1)
class App(wx.App):
def OnInit(self):
TestFrame(None, "Test")
return True
if __name__ =3D=3D "__main__":
app =3D App()
app.MainLoop()
# END CODE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200608=
10/95b8c72e/attachment.htm
More information about the wxpython-users
mailing list