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()