[Pygui] Show_text only appearing in last widget

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Dec 13 00:15:27 CET 2010


Colin Brown wrote:

> I am expecting to see text written into each of the coloured squares  
> but I can only see text in the last square; why is this?

You need a canvas.newpath() call before drawing the rect. Otherwise
you're building up a single path that includes all the previous
rects and draws over the text you've written before.

    def draw(self, canvas):
      l,t,r,b = self.rect
      canvas.newpath() # <-- add this here
      canvas.moveto(l,t)

-- 
Greg


More information about the Pygui mailing list