[wxPython-users] Another sizer question

Alun Griffiths alun.griffiths at dsl.pipex.com
Mon Nov 12 08:29:59 PST 2007


Christopher

tried both hints but the problem is still 
there.  PlotFrame.__init__() also sets a sizer - is the problem that 
there is some interference between the sizers?

Alun Griffiths

At 18:30 11/11/2007, you wrote:

>Alun Griffiths wrote:
>>thanks for the quick reply but now I'm confused!  The first line of 
>>the constructor for self.plot is
>>         wx.Frame.__init__(self, parent, wx.ID_ANY, size=(320,100), 
>> title='Production profile')
>>which I assumed set the size.  I also thought that
>
>well, yes, but when you call SetSizerAndFit() you're asking the 
>frame to fit itself, so if plot doesn't have a min size, it could 
>get shrunk down. Try plot.SetSizeHints()

I added

self.SetMinSize((320,100))

to PlotFrame.__init__() but that did not help either.  Still not sure 
why I meed to do this - WxPIA (p335) says "If the control is created 
with a size explicitly set, that size overrides the control's default 
calculation of its best minimum size".  So if I define the size 
explicitly during the call to __init__ (which I do), doesn't this 
mean that I don't need to bother with SetMinSize?


>>         box.Add(lhsSizer, 0)
>>         box.Add(self.plot, 1)
>>meant that if box got resized that alll the resizing would be done 
>>by self.plot and lhsSizer would not change
>
>yup -- but only in the direction of the box -- try:
>
>          box.Add(self.plot, 1, wx.EXPAND)
>
>it may help.

Nope, that didn't solve the problem either, but thanks for the hint!






More information about the wxpython-users mailing list