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 = 1
class TestFrame(wx.Frame):
def init(self, parent, title):
wx.Frame._init
_(self, parent, title=title, style=wx.DEFAULT_FRAME_STYLE|wx.CENTRE)
size = self.GetClientSize()
self._panel = ScrolledPanel.ScrolledPanel(self, -1, size=size, style=wx.SUNKEN_BORDER)
self._sizer = wx.BoxSizer(wx.VERTICAL)
self._panel.SetSizer(self._sizer)
self._panel.SetupScrolling()
sp = ScrolledPanel.ScrolledPanel(self._panel, -1, size=(-1,100), style=wx.SUNKEN_BORDER)
spsizer = 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 = wx.ProgressDialog("Fooooo", "Barrrr", maximum=10,
style=wx.PD_APP_MODAL|wx.PD_ELAPSED_TIME|wx.PD_ESTIMATED_TIME|wx.PD_REMAINING_TIME|wx.PD_AUTO_HIDE)
v = 0
for i in xrange(10):
spsizer.Add(wx.StaticText(sp, wx.ID_ANY, "Whatever goes here!"), flag=wx.EXPAND|wx.ALL)
v += 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 == “main”:
app = App()
app.MainLoop()