cheers,
Stef
Andrea Gavana wrote:
> Hi Stef,
>
> On Dec 12, 2007 1:14 AM, Stef Mientki wrote:
>
>> hello,
>>
>> I'm trying to put PyPlot on an AUI-window,
>> so it will fill the whole window,
>> but the code below (with or without boxsizer),
>> just gives a very small PyPlot window 30*30 pixels or so in the upper
>> left corner.
>>
>> class Control_Pane ( wx.Window ):
>> def __init__ ( self, parent, Brick, Title = 'Edit Values Below',
>> Help = '' ) :
>> wx.Window.__init__ ( self, parent )
>>
>> self.Canvas = plot.PlotCanvas ( self )
>> self.Canvas.SetEnableGrid ( True )
>> self.Canvas.SetYSpec ( 'auto' )
>>
>> #self.AutoLayout()
>> sizer = wx.BoxSizer()
>> sizer.Add(self.Canvas, 1, wx.EXPAND)
>> self.SetSizer(sizer)
>> self.Fit()
>>
>> What am I doing wrong ?
>> Or even better, how should I do it right ?
>>
>
> There might be 2 issues here, and I don't know which one applies. The
> first one is, use wx.Panel instead of wx.Window to hold your PyPlot.
> Second one, I don't know if PyPlot implements DoGetBestSize. If it
> doesn't, the sizer doesn't know which size to allocate to PyPlot.
>
>
> Andrea.
>
> "Imagination Is The Only Weapon In The War Against Reality."
> http://xoomer.alice.it/infinity77/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-user...@lists.wxwidgets.org
> For additional commands, e-mail: wxPython-...@lists.wxwidgets.org
>
>
>
>
I'm trying to put PyPlot on an AUI-window,
so it will fill the whole window,
but the code below (with or without boxsizer),
just gives a very small PyPlot window 30*30 pixels or so in the upper
left corner.
class Control_Pane ( wx.Window ):
def __init__ ( self, parent, Brick, Title = 'Edit Values Below',
Help = '' ) :
wx.Window.__init__ ( self, parent )
self.Canvas = plot.PlotCanvas ( self )
self.Canvas.SetEnableGrid ( True )
self.Canvas.SetYSpec ( 'auto' )
#self.AutoLayout()
sizer = wx.BoxSizer()
sizer.Add(self.Canvas, 1, wx.EXPAND)
self.SetSizer(sizer)
self.Fit()
What am I doing wrong ?
Or even better, how should I do it right ?
thanks,
Stef Mientki
For the record this is because wx.Window's default EVT_SIZE handler does
not do the auto layout, because it does not make sense for *all* of the
descendants of wx.Window to inherit this behavior, so only those that
are intended to be containers do it. If you ever do want to have a
wx.Window that does auto layout with a sizer, all you need to do is just
give it a EVT_SIZE handler that calls self.Layout.
> Second one, I don't know if PyPlot implements DoGetBestSize. If it
> doesn't, the sizer doesn't know which size to allocate to PyPlot.
Since it is getting added to the sizer with proportion=1 and
flags=wx.EXPAND it doesn't need to have a DoGetBestSize. But even if it
wasn't set to fill the all sizer's allotted space like this you can work
around the lack of a DoGetBestSize simply by calling SetMinSize with
whatever you want the minimum to be.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!