wxPython StatusBar Help

Discussion in 'Python' started by herve, Jan 29, 2007.

  1. herve

    herve Guest

    Hi, everybody

    I'm working with wxPython 2.8.1.1.

    Does anybody know how to change the foreground colors in a wx.StatusBar
     
    herve, Jan 29, 2007
    #1
    1. Advertising

  2. Hi,
    > I'm working with wxPython 2.8.1.1.
    >
    > Does anybody know how to change the foreground colors in a wx.StatusBar

    You can get inspiration from the following code, but the problem is you
    will have also to draw all the status bar stuff, not only the foreground
    color.
    I don't know any other way. However, I'm used to 2.6 and I could miss
    something existing in 2.8 (I think to OnCreateStatusBar which exists and
    don't work in 2.6 and was supposed to work with the next release ; it
    could be a clue).
    Regards,
    jm


    import wx
    class MyStatusBar(wx.StatusBar):
    def __init__(self,*args,**kargs):
    wx.StatusBar.__init__(self,*args,**kargs)
    self.Bind(wx.EVT_PAINT,self.OnPaint)
    def OnPaint(self,event):
    dc = wx.PaintDC(self)
    self.Draw(dc)
    def Draw(self,dc):
    dc.BeginDrawing()
    dc.SetBackground( wx.Brush("White") )
    dc.Clear()
    dc.SetPen(wx.Pen('BLACK'))
    dc.DrawText(self.GetStatusText(),0,0)
    dc.EndDrawing()
    if __name__ == "__main__":
    app = wx.PySimpleApp()
    frame= wx.Frame(None,wx.ID_ANY,'test frame')
    statusBar= MyStatusBar(frame,wx.ID_ANY)
    statusBar.SetStatusText("status text..")
    frame.SetStatusBar(statusBar)
    frame.Show(True)
    app.MainLoop()
     
    jean-michel bain-cornu, Jan 30, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Munro

    MDI StatusBar

    Kevin Munro, Nov 3, 2003, in forum: Java
    Replies:
    0
    Views:
    509
    Kevin Munro
    Nov 3, 2003
  2. Adam Prenosil

    Javascript link and statusbar

    Adam Prenosil, Jul 30, 2003, in forum: HTML
    Replies:
    8
    Views:
    415
  3. Michele Locati
    Replies:
    1
    Views:
    399
    Michele Locati
    Jun 27, 2005
  4. Scott

    Browser Statusbar

    Scott, Jan 15, 2004, in forum: ASP General
    Replies:
    2
    Views:
    100
    Curt_C [MVP]
    Jan 15, 2004
  5. Jayson Williams

    Tk StatusBar help

    Jayson Williams, Oct 5, 2007, in forum: Ruby
    Replies:
    2
    Views:
    140
    Hidetoshi NAGAI
    Oct 6, 2007
Loading...

Share This Page