Change in the appearance with OS

Hi,
I have been using wxpython in fedora. I have written a small code that
displays a customtreectrl in a spliiter window. This was working fine
in Fedora but when the code was run in windows the dialog box is
displayed empty.
The main code is:

class TreeDialog(wx.Dialog):

    def __init__(self):

        wx.Dialog.__init__(self, None, 6, 'Filters',size = (500,600) )
        self.splitter = wx.SplitterWindow(self, -1)
        leftPanel = wx.Panel(self.splitter, -1)
        leftBox = wx.BoxSizer(wx.VERTICAL)
        self.__tree = TreeFilter(leftPanel, 1)
        leftBox.Add(self.__tree, -1, wx.GROW)
        self.__tree.Bind(CT.EVT_TREE_ITEM_CHECKED, self.checked)
        leftPanel.SetSizer(leftBox)

        rightPanel = wx.Panel(self.splitter, -1)
        rightBox = wx.BoxSizer(wx.VERTICAL)
        self.display = wx.StaticText(rightPanel, -1, '',
style=wx.ALIGN_LEFT)
        rightBox.Add(self.display, -1, wx.GROW)

        btnsizer = wx.StdDialogButtonSizer()
        btn = wx.Button(rightPanel, wx.ID_OK)
        btn.SetDefault()
        btnsizer.AddButton(btn)

        btn = wx.Button(rightPanel, wx.ID_CANCEL)
        btnsizer.AddButton(btn)
        btnsizer.Realize()
        rightBox.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
        rightPanel.SetSizer(rightBox)

        self.splitter.SplitVertically(leftPanel, rightPanel)
        self.Centre()

Where TreeFilter is the customtreectrl that was written in a seperate
class.

Please help me in understanding the problem.

Since you define the size of the dialog at the beginning then it's possible that there isn't an extra size event after the sizers and widgets have been created, and so there is no automatic layout. Try adding a call to self.SendSizeEvent() at the end of __init__.

···

On 5/20/12 11:47 PM, Sushma wrote:

Hi,
I have been using wxpython in fedora. I have written a small code that
displays a customtreectrl in a spliiter window. This was working fine
in Fedora but when the code was run in windows the dialog box is
displayed empty.
The main code is:

class TreeDialog(wx.Dialog):

     def __init__(self):

         wx.Dialog.__init__(self, None, 6, 'Filters',size = (500,600) )
         self.splitter = wx.SplitterWindow(self, -1)
         leftPanel = wx.Panel(self.splitter, -1)
         leftBox = wx.BoxSizer(wx.VERTICAL)
         self.__tree = TreeFilter(leftPanel, 1)
         leftBox.Add(self.__tree, -1, wx.GROW)
         self.__tree.Bind(CT.EVT_TREE_ITEM_CHECKED, self.checked)
         leftPanel.SetSizer(leftBox)

         rightPanel = wx.Panel(self.splitter, -1)
         rightBox = wx.BoxSizer(wx.VERTICAL)
         self.display = wx.StaticText(rightPanel, -1, '',
style=wx.ALIGN_LEFT)
         rightBox.Add(self.display, -1, wx.GROW)

         btnsizer = wx.StdDialogButtonSizer()
         btn = wx.Button(rightPanel, wx.ID_OK)
         btn.SetDefault()
         btnsizer.AddButton(btn)

         btn = wx.Button(rightPanel, wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
         rightBox.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
         rightPanel.SetSizer(rightBox)

         self.splitter.SplitVertically(leftPanel, rightPanel)
         self.Centre()

Where TreeFilter is the customtreectrl that was written in a seperate
class.

Please help me in understanding the problem.

--
Robin Dunn
Software Craftsman