Exemplo n.º 1
0
 def draw(self):    
     if not self.visible: return
     super(PolygonButton, self).draw()
     
     x, y = self.x+self.width/2, self.y+self.height/2
     poly = self.generate_polygon(x,y,x,self.y+self.height*0.9,self.sides)
     if self.fill:
         if graphics.fill_rainbow():
             graphics.set_color(1,1,1,1)
         else:
             graphics.set_color(color=graphics.fill_color)
         draw.polygon(poly)
     if self.outline:
         graphics.set_line_width(2)
         if graphics.line_rainbow():
             graphics.set_color(1,1,1,1)
         else:
             graphics.set_color(color=graphics.line_color)
         draw.line_loop(poly)
         draw.points(poly)
Exemplo n.º 2
0
 def draw(self):
     if self.which_color == 0:
         if graphics.line_rainbow():
             draw.rainbow(self.x,self.y,self.x+self.width,self.y+self.height)
         else:
             graphics.set_color(color=graphics.line_color)
             draw.rect(self.x, self.y, self.x+self.width, self.y+self.height)
     else:
         if graphics.fill_rainbow():
             draw.rainbow(self.x,self.y,self.x+self.width,self.y+self.height)
         else:
             graphics.set_color(color=graphics.fill_color)
             draw.rect(self.x, self.y, self.x+self.width, self.y+self.height)
     
     if self.selected:
         graphics.set_color(1,1,1,1)
         graphics.set_line_width(1)
         draw.ellipse_outline(self.x+5, self.y+5, self.x+self.width-5, self.y+self.height-5)
         graphics.set_color(0,0,0,1)
         draw.ellipse_outline(self.x+7, self.y+7, self.x+self.width-7, self.y+self.height-7)
     graphics.set_line_width(1.0)    
     graphics.set_color(0,0,0,1)
     draw.rect_outline(self.x, self.y, self.x+self.width, self.y+self.height)