Does anyone know the proper way to change the size (the width, specifically)
of the TreeCtrl within a Treebook? I've tried this (I'm abstracting the
containing class out for simplicity as "parent"):
tb = wx.Treebook(parent)
tb.GetTreeCtrl().SetMinSize((250, 0))
tb.GetTreeCtrl().InvalidateBestSize()
parent.SendSizeEvent()
Then, in each notebook page, I have:
def OnSize(self, event):
self.SetPosition((260, 0))
self.SetSize(event.GetSize())
self.Layout()
which is bound to EVT_SIZE. This works sometimes in OS X and occasionally
half-works in Windows (the notebook pages start at the right position, but
the TreeCtrl remains the default size.) I haven't bothered testing it in
Linux yet, as I don't need to support Linux for this app.
Any ideas?
Thanks,
Jeff
<div dir="ltr">Does anyone know the proper way to change the size (the width, specifically) of the TreeCtrl within a Treebook? I've tried this (I'm abstracting the containing class out for simplicity as "parent"):<br>
<br>tb = wx.Treebook(parent)<br>tb.GetTreeCtrl().SetMinSize((250, 0))<br>tb.GetTreeCtrl().InvalidateBestSize()<br>parent.SendSizeEvent()<br><br>Then, in each notebook page, I have:<br><br> def OnSize(self, event):<br> self.SetPosition((260, 0))<br>
self.SetSize(event.GetSize())<br> self.Layout()<br><br>which is bound to EVT_SIZE. This works sometimes in OS X and occasionally half-works in Windows (the notebook pages start at the right position, but the TreeCtrl remains the default size.) I haven't bothered testing it in Linux yet, as I don't need to support Linux for this app.<br>
<br>Any ideas?<br><br>Thanks,<br>Jeff<br></div>
_______________________________________________
wxpython-users mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Jeff Fein-Worton wrote:
> Does anyone know the proper way to change the size (the width,
> specifically) of the TreeCtrl within a Treebook? I've tried this (I'm
> abstracting the containing class out for simplicity as "parent"):
>
> tb = wx.Treebook(parent)
> tb.GetTreeCtrl().SetMinSize((250, 0))
> tb.GetTreeCtrl().InvalidateBestSize()
> parent.SendSizeEvent()
>
> Then, in each notebook page, I have:
>
> def OnSize(self, event):
> self.SetPosition((260, 0))
> self.SetSize(event.GetSize())
> self.Layout()
>
> which is bound to EVT_SIZE. This works sometimes in OS X and
> occasionally half-works in Windows (the notebook pages start at the
> right position, but the TreeCtrl remains the default size.) I haven't
> bothered testing it in Linux yet, as I don't need to support Linux for
> this app.
I think I would do it by intercepting the EVT_SIZE event of the
Treebook. In that handler you can position and size the tree and the
page windows however you want, and if you don't call event.Skip() then
the default handler won't be run.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
_______________________________________________
wxpython-users mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users