[wxPython-users] wx.lib.customtreectrl wnd=panel

Jorgen Bodde jorgen.maillist at gmail.com
Fri May 4 10:06:18 PDT 2007


Hi,

To my best guess there is something wrong using panels with
CustomTreeCtrl. I played a bit with it, the gauge is not displayed
inside the panel correctly, but the gauge can be made a child of the
CustomTreeCtrl without problems..

I think Andrea will have to take it from here, I see nothing wrong
fundamentally with your code..

- Jorgen

On 5/4/07, Zac Burns <zac256 at gmail.com> wrote:
> Greetings, I can't seem to get a control to show up as a child of a panel in
> a CustomTreeCtrl. You can follow a small conversation about it here
> http://wxforum.shadonet.com/viewtopic.php?p=62328#62328 .
> To sum it up they believed that it may be a parenting problem.
>
> Below is a sample app demonstrating the problem. The important code is in
> customTreeCtrlTest.AddItems(). There you can see that I'm trying to add 2
> gauges to a panel and have both gauges be visible next to each other in the
> tree.
>
> I am using WindowsXP:SP2, Python2.5, and wx-2.8-msw-unicode.
>
> If any of you can point me to the problem below that would be much
> appreciated.
>
> --
> Zachary Burns
> (407)590-4814
> Aim - Zac256FL
>  Technical Artist(Digital Overlord, melGuru)
> Kush Games
>
> // BEGIN SAMPLE CODE
> import wx
> import wx.lib.customtreectrl as CustomTreeCtrl
>
> class customTreeCtrlTest(CustomTreeCtrl.CustomTreeCtrl):
>     def __init__(self, parent, id= wx.ID_ANY, pos=wx.DefaultPosition,
>              size=wx.DefaultSize,
>              style=wx.SUNKEN_BORDER,
>              ctstyle=CustomTreeCtrl.TR_HAS_BUTTONS
>              |CustomTreeCtrl.TR_HAS_VARIABLE_ROW_HEIGHT,
>              log=None):
>
>         CustomTreeCtrl.CustomTreeCtrl.__init__(self,
> parent, id, pos, size, style, ctstyle)
>
>     def AddItems(self):
>         self.root = self.AddRoot("The Root Item")
>          self.root.Expand()
>
>         panel = wx.Panel(self, -1)
>
>         element = wx.Gauge(panel, -1, 100,
> style=wx.GA_HORIZONTAL|wx.GA_SMOOTH)
>         element2 = wx.Gauge(panel, -1, 100,
> style=wx.GA_HORIZONTAL|wx.GA_SMOOTH )
>
>         sizer = wx.BoxSizer(wx.HORIZONTAL)
>         sizer.Add(element, -1, wx.EXPAND)
>         sizer.Add(element2, -1, wx.EXPAND)
>         panel.SetSizer(sizer)
>         sizer.Layout()
>
>         self.AppendItem (self.root, "test", wnd=panel)
>
>
> def test():
>     class customTreeCtrlTestFrame(wx.Frame):
>         def __init__(self):
>             wx.Frame.__init__(self, None, -1, "Demo", size = (950, 720),
>                 style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
>
>             panel = wx.Panel(self, -1)
>
>             sizer = wx.BoxSizer(wx.VERTICAL)
>             self.tree = customTreeCtrlTest(panel, -1)
>             self.tree.AddItems()
>
>             sizer.Add(self.tree, 1, wx.EXPAND)
>             panel.SetSizer(sizer)
>             sizer.Layout()
>
>     app = wx.PySimpleApp()
>     frame = customTreeCtrlTestFrame()
>     frame.Show()
>     app.MainLoop()
>
> test()
>
> // END SAMPLE CODE
>




More information about the wxpython-users mailing list