StatusBar works on Linux, not on Windows

I am developing on Linux (at home) and testing on Windows (at work).

I have a statusbar that seems to work OK on Linux but does not display
on Windows, just leaves an empty space.

The relevant code is:

class CustomStatusBar(wx.StatusBar):
    def __init__(self, parent):
        wx.StatusBar.__init__(self, parent, -1)

        # This status bar has three fields
        self.SetFieldsCount(3)
        # Sets the three fields to be relative widths to each other.
        self.SetStatusWidths([-1, -2, -2])
        self.sizeChanged = False

        self.SetStatusText("Bucket Status - Idle", 0)
        self.SetStatusText("Selected Controller %s" %
selectedController, 1)
        self.SetStatusText("Selected Emulator %s" % selectedEmulator,
2)

        pub.subscribe(self.onChange, 'update')

    def onChange(self,msg):
      if msg.topic == ('update','controller'):
        self.SetStatusText("Selected Controller %s" % msg.data, 1)
      elif msg.topic == ('update','emulator'):
        self.SetStatusText("Selected Emulator %s" % msg.data, 2)

=== and I use it inside my frame subclass ===

class David(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self,None,title='Emulator Farm')
        p = wx.Panel(self)
        p.SetBackgroundColour("White")
        nb = wx.Notebook(p)
        self.sb = CustomStatusBar(p)
        b = wx.BoxSizer(orient=wx.VERTICAL)
        b.Add(self.sb,0)
        etc etc etc ...

I will post this latest question as a separate topic.

Thanks
David

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

The native status bar on Windows is a little funky and it overrides a few of the normal wx.Window behaviors in an unexpected ways, so it needs to be managed by the frame to work correctly. Make the statusbar be a child of the frame, and use self.SetStatusBar(self.sb)

···

On 5/13/10 1:53 AM, dubiboy wrote:

I am developing on Linux (at home) and testing on Windows (at work).

I have a statusbar that seems to work OK on Linux but does not display
on Windows, just leaves an empty space.

The relevant code is:

class David(wx.Frame):
     def __init__(self):
         wx.Frame.__init__(self,None,title='Emulator Farm')
         p = wx.Panel(self)
         p.SetBackgroundColour("White")
         nb = wx.Notebook(p)
         self.sb = CustomStatusBar(p)
         b = wx.BoxSizer(orient=wx.VERTICAL)
         b.Add(self.sb,0)
         etc etc etc ...

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

SOLVED.

Thanks Gadget/Steve and Robin

Used the method suggested and it works now also in Windows.

David

···

On May 13, 7:14 pm, Robin Dunn <ro...@alldunn.com> wrote:

On 5/13/10 1:53 AM, dubiboy wrote:

> I am developing on Linux (at home) and testing on Windows (at work).

> I have a statusbar that seems to work OK on Linux but does not display
> on Windows, just leaves an empty space.

> The relevant code is:

> class David(wx.Frame):
> def __init__(self):
> wx.Frame.__init__(self,None,title='Emulator Farm')
> p = wx.Panel(self)
> p.SetBackgroundColour("White")
> nb = wx.Notebook(p)
> self.sb = CustomStatusBar(p)
> b = wx.BoxSizer(orient=wx.VERTICAL)
> b.Add(self.sb,0)
> etc etc etc ...

The native status bar on Windows is a little funky and it overrides a
few of the normal wx.Window behaviors in an unexpected ways, so it needs
to be managed by the frame to work correctly. Make the statusbar be a
child of the frame, and use self.SetStatusBar(self.sb)

--
Robin Dunn
Software Craftsmanhttp://wxPython.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visithttp://groups.google.com/group/wxPython-users?hl=en

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en