I've been noticing this effect for quite some time, and I'm wondering if
anyone else is seeing the effect:
When creating a wxBoxSizer-driven layout for a dialog (but not a
panel), I seem to get an effect where all of the widgets are piled on top of
each other. The widgets are all immediate children of a dialog, are all
added to the sizer. The sizer is registered as the dialog's sizer. And
AutoLayout is set to true.
Exactly the same code on a panel in a frame gives the expected
layout (but lacks the nice modal interfaces).
I've spent probably five or six days trying to debug various dialogs showing
this problem, but have been unable to track down why it is occurring, so
have just wound up rewriting those applications to not use dialogs (which is
somewhat less than ideal). My current application really does need dialogs.
I'm assuming the problem is some ridiculously simple thing I'm forgetting,
but with this simple an example I can't imagine what it is.
This is with 2.1.16, I believe the same problem was occurring with 2.1.15, I
don't think 2.1.13 showed the problem. Could it be there is now an explicit
EVT_SIZE declaration required?
Any help appreciated,
Mike
from wxPython.wx import *
class Test (wxDialog):
def __init__( self, *arguments, **namedarguments):
apply(wxDialog.__init__, (self,) +arguments, namedarguments)
outerSizer = wxBoxSizer( wxVERTICAL )
self.guage = wxGauge(
self, -1, 32,
style = wxGA_HORIZONTAL|wxGA_SMOOTH,
)
outerSizer.Add( self.guage, 2, wxEXPAND )
self.okbutton = wxButton( self, -1, "OK")
outerSizer.Add( self.okbutton, 1, wxEXPAND )
self.SetSizer(outerSizer)
self.SetAutoLayout(true)
class TestPanel (wxPanel):
def __init__( self, *arguments, **namedarguments):
apply(wxPanel.__init__, (self,) +arguments, namedarguments)
outerSizer = wxBoxSizer( wxVERTICAL )
self.guage = wxGauge(
self, -1, 32,
style = wxGA_HORIZONTAL|wxGA_SMOOTH,
)
outerSizer.Add( self.guage, 2, wxEXPAND )
self.okbutton = wxButton( self, -1, "OK")
outerSizer.Add( self.okbutton, 1, wxEXPAND )
self.SetSizer(outerSizer)
self.SetAutoLayout(true)
class TestApp( wxPySimpleApp ):
def OnInit( self ):
self.base = wxFrame(NULL, -1, "Testing Frame with Panel",
size = (300, 200) )
self.panel = TestPanel (self.base, -1)
self.SetTopWindow( self.base)
self.base.Show( true )
self.test = Test( self.base, -1, "Testing Dialog", size =
(300,200) )
self.test.Show( true )
return true
if __name__ == "__main__":
app = TestApp()
## frame = Test( NULL, -1, "Testing")
## frame.ShowModal()
app.MainLoop()
···
__________________________________
Mike C. Fletcher
Designer, VR Plumber
http://members.home.com/mcfletch