[wxPython-users] Re: how ... todo in PyPlot ?
Stef Mientki
s.mientki at ru.nl
Sat Dec 15 06:05:49 PST 2007
thanks Christian,
>> 2. How to change the background color
>> (this not just aesthetic, but it's proven that you can distinguish more
>> different colors on a black background)
>> I tried
>> self.plot.SetBackgroundColour ( self.CP_BG.GetColour () )
>> but it doesn't work
>>
>
>
> You can't without modifying the code. I admit, this would be nice to have.
> Find the _Draw method in plot.py and put something like the following
>
> br = wx.Brush(wx.RED, wx.SOLID)
> dc.SetBackground(br)
> dc.SetBackgroundMode(wx.SOLID)
>
> before the call to dc.Clear (around line 1000).
>
>
It works great, I also added a few lines to color the axis numbers the
same as grid/background.
I also put this as a future request on the wxPython.org.
cheers,
Stef
if dc == None:
# sets new dc and clears it
dc = wx.BufferedDC(wx.ClientDC(self.canvas), self._Buffer)
# ADDED ############################################
br = wx.Brush(self.GetBackgroundColour(), wx.SOLID)
dc.SetBackground(br)
dc.SetBackgroundMode(wx.SOLID)
# END ADDED ############################################
dc.Clear()
dc.BeginDrawing()
# dc.Clear()
# set font size for every thing but title and legend
dc.SetFont(self._getFont(self._fontSizeAxis))
# ADDED ############################################
dc.SetTextBackground(self.GetBackgroundColour())
dc.SetTextForeground(self._gridColour)
# END ADDED ############################################
More information about the wxpython-users
mailing list