Gradient

Hello Friends,

I have tried to use GradientFillLinear and GradientFillConcentric but with no success.

When I try a linear gradient, I get a white rectangle.
When I try a concentric gradient, I get a plain red rectangle.

What is wrong with my code? My system: Mac OS X 10.3.9. Python 2.3. wxPython 2.7.1.3.

Thank you,
Marcio

···

#----------------------------------------
import wx

COR1 = wx.Colour(0, 255, 0)
COR2 = wx.Colour(255, 0, 0)

class Form1(wx.Window):
def init(self, parent, id):
wx.Window.init(self, parent, id)
wx.EVT_PAINT(self, self.OnPaint)

def OnPaint(self, evento):
    dc = wx.PaintDC(self)
    dc.BeginDrawing()
    larg, alt = self.GetSize()

 r1  = wx.Rect(0, 0, 150, 150)
    dc.GradientFillLinear(r1, COR1, COR2)
    r2  = wx.Rect(150, 150, 150, 150)
    dc.GradientFillConcentric(r2, COR1, COR2, wx.Point(5, 5))
    dc.DrawLine(0, 0, larg, alt)

app = wx.PySimpleApp()
frame = wx.Frame(None, -1, “Teste”)
Form1(frame,-1)
frame.Show(1)
app.MainLoop()


Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!

Marcio Moreira wrote:

Hello Friends,

I have tried to use GradientFillLinear and GradientFillConcentric but with no success.

When I try a linear gradient, I get a white rectangle.
When I try a concentric gradient, I get a plain red rectangle.

What is wrong with my code? My system: Mac OS X 10.3.9. Python 2.3. wxPython 2.7.1.3.

It looks like this is fixed in 2.7.2.0. (Coming soon.)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!