def get_gradient_text_solid_bg(text,font,font_style,point_size,top_colour,bottom_colour,bg_colour_tuple):
dc=wx.MemoryDC()
f=getFont(font,font_style)
f.SetFaceName(font)
f.SetPointSize(point_size)
dc.SetFont(f)
dc.SelectObject(wx.Bitmap(0,0,settings.DEFAULT_BITMAP_DEPTH))
w,h= dc.GetTextExtent(text)
template_bmp= wx.Bitmap(w,h,settings.DEFAULT_BITMAP_DEPTH)
dc.SelectObject(template_bmp)
dc.SetBackground(wx.Brush(settings.BG_COLOUR))
dc.Clear()
dc.DrawText(text,0,0)
dc.SelectObject(wx.NullBitmap)
template_image= template_bmp.ConvertToImage()
template_bmp= template_image.ConvertToBitmap()
text_bmp= wx.Bitmap(w,h,settings.DEFAULT_BITMAP_DEPTH)
dc.SelectObject(text_bmp)
dc.GradientFillLinear((0,0,w,h),top_colour,bottom_colour,wx.SOUTH)
dc.DrawBitmap(template_bmp,0,0)
dc.SelectObject(wx.NullBitmap)
return text_bmp
Hi. I'm in the process of updating to Phoenix and the gradient text doesn't render anymore (example).
This is the code I was using in wx 2:
I don't understand how this is supposed to work. You draw text
into template_bmp in an unspecified foreground color with a
BG_COLOUR background. Then you gradient fill text_bmp and
overwrite the whole thing with template_bmp. What did you expect
this to produce? What is the end result supposed to be?
And what do you believe this accomplished?
template_image = template_bmp.ConvertToImage()
template_bmp = template_image.ConvertToBitmap()
-- Tim Roberts, ti...@probo.com Providenza & Boekelheide, Inc.