471,120 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,120 software developers and data experts.

wxPython StatusBar Help

Hi, everybody

I'm working with wxPython 2.8.1.1.

Does anybody know how to change the foreground colors in a wx.StatusBar
Jan 29 '07 #1
1 2558
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()
Jan 30 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by mdk.R | last post: by
reply views Thread by Scott | last post: by
18 posts views Thread by Andrew Poulos | last post: by
2 posts views Thread by rodmc | last post: by
3 posts views Thread by John Salerno | last post: by
4 posts views Thread by w.p. | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.