[wxPython] SetTextBackground seems to have no effect?

Hello wxPythonistas:

I am trying to draw text with background colour. Although SetTextForeground
works
as documented, SetTextBackground seems not to have any effect. I am
expecting
a red background using the Draw function below, but I get a standard window
colour
instead. The control being drawn is within a grid within a frame.

How do I set the text background colour?

Thanks,
    Parzival

···

-------------------------------------------------
    def Draw(self,dc):
        w, h = self.GetClientSizeTuple()
        dc.BeginDrawing()
        dc.SetFont(self.GetFont())
        tw, th, td, tx = self.GetFullTextExtent(self.text)
        alignV = self.align & 3
        if alignV == AlignTop:
            y = 0
        elif alignV == AlignMidRise:
            y = (h - th + td)/2
        elif alignV == AlignMidText:
            y = (h - th)/2
        else: # alignV == AlignBot:
            y = h - th
        alignH = self.align & 12
        if alignH == AlignLeft:
            x = 0
        elif alignH == AlignCenter:
            x = (w - tw)/2
        else: # alignH == AlignRight:
            x = w - tw

        dc.Clear()
        dc.SetTextForeground(wxBLUE)
        dc.SetTextBackground(wxRED)

        dc.DrawText(self.text, x, y)
        dc.EndDrawing()

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users

dc.SetBackgroundMode(wxSOLID)

···

-------------------------------------------------------------------------
Chris Fama <mailto:Chris.Fama@uq.net.au> Phone:(07) 3870 5639
Brisbane, Australia Mobile:(0400) 833 700
-------------------------------------------------------------------------
"But what ... is it good for?"
--Engineer at the Advanced Computing Systems Division of IBM,
   1968, commenting on the microchip.

-----Original Message-----
From: wxpython-users-admin@lists.sourceforge.net
[mailto:wxpython-users-admin@lists.sourceforge.net]On Behalf Of Parzival
Herzog
Sent: Saturday, 27 January 2001 4:34 PM
To: wxPython user list
Subject: [wxPython] SetTextBackground seems to have no effect?

Hello wxPythonistas:

I am trying to draw text with background colour. Although
SetTextForeground
works
as documented, SetTextBackground seems not to have any effect. I am
expecting
a red background using the Draw function below, but I get a
standard window
colour
instead. The control being drawn is within a grid within a frame.

How do I set the text background colour?

Thanks,
    Parzival

-------------------------------------------------
    def Draw(self,dc):
        w, h = self.GetClientSizeTuple()
        dc.BeginDrawing()
        dc.SetFont(self.GetFont())
        tw, th, td, tx = self.GetFullTextExtent(self.text)
        alignV = self.align & 3
        if alignV == AlignTop:
            y = 0
        elif alignV == AlignMidRise:
            y = (h - th + td)/2
        elif alignV == AlignMidText:
            y = (h - th)/2
        else: # alignV == AlignBot:
            y = h - th
        alignH = self.align & 12
        if alignH == AlignLeft:
            x = 0
        elif alignH == AlignCenter:
            x = (w - tw)/2
        else: # alignH == AlignRight:
            x = w - tw

        dc.Clear()
        dc.SetTextForeground(wxBLUE)
        dc.SetTextBackground(wxRED)

        dc.DrawText(self.text, x, y)
        dc.EndDrawing()

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/wxpython-users