[wxPython-users] Bitmap text only writes in black under Linux
Steve Holden
steve at holdenweb.com
Mon Jun 12 07:34:04 PDT 2006
Steve Holden wrote:
[...]
>
> def write( text, bitmap, pos=(0,0), font=None, color=None):
> """Simple write into a bitmap doesn't do any checking."""
> memory = wx.MemoryDC()
> _setupContext(memory, font, color)
> memory.SelectObject(bitmap)
> width, height = memory.GetTextExtent(text)
> print "Writing", text, "in color, font", color, font, "in",
> width, "x", height
> try:
> memory.DrawText(text, pos[0],pos[1],)
> finally:
> memory.SelectObject(wx.NullBitmap)
> return width
>
One definite problem I have discovered is that the width and height of
the text returned by GetTextExtent() in the code above appears,
according to debugging prints, to be (0, 0) on Ubuntu Linux, while on
Windows I get definite sizes. When the background is non-black I do see
(black) text, but this makes me wonder whether there's some font oddity
or subtlety I have overlooked.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Love me, love my blog http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the wxpython-users
mailing list