Gradient Text update from wxPython 2 to Phoenix

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:

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

I looked at the differences between the two versions but couldn’t find anything.

Any pointers would be much appreciated.

Thanks!

···

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/8925de27-95b9-4f23-900a-06b9f65315b6%40googlegroups.com.

– You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to .
To view this discussion on the web visit .

···

Mihails Murasovs wrote:

      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, Providenza & Boekelheide, Inc.

wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/d/msgid/wxpython-users/4811b82a-5783-f326-5014-012da20c502e%40probo.com
timr@probo.com