Esempio n. 1
0
 def switch_on(self):
     global button_status
     if self.switch:
         self.status = button_status.ON
         self.switch_status = True
         # change color of rect to co color
         draw.rect_color(self.rect, self.co)
Esempio n. 2
0
 def switch_off(self):
     global button_status
     if self.switch:
         self.status = button_status.NORMAL
         self.switch_status = False
         # change color of rect to normal color
         draw.rect_color(self.rect, self.c)
Esempio n. 3
0
 def move(self, mx, my):
     # move the button by some amount
     # update text and rect position
     self.show()
     self.x += mx
     self.y += my
     draw.move(self.rect, draw.go.RECT, mx, my)
     draw.move(self.tid, draw.go.TEXT, mx, my)
     self.status = 0
     draw.rect_color(self.rect, self.c)
Esempio n. 4
0
 def set_pos(self, x, y):
     # set absolute position
     # update text and rect position
     self.show()
     self.x = x
     self.y = y
     draw.set_pos(self.rect, draw.go.RECT, x, y)
     draw.set_pos(self.tid, draw.go.TEXT, x + self.w / 2, y + self.h / 2)
     self.status = 0
     draw.rect_color(self.rect, self.c)
Esempio n. 5
0
 def switch_off(self):
     global button_status
     if self.switch:
         self.status = button_status.NORMAL
         self.switch_status = False
         draw.rect_color(self.rect, self.color)
Esempio n. 6
0
 def switch_on(self):
     global button_status
     if self.switch:
         self.status = button_status.ON
         self.switch_status = True
         draw.rect_color(self.rect, (255, 255, 0, 100))
Esempio n. 7
0
    def mouse_over(self, mx, my):
        global button_status

        if self.switch:
            # is switch
            if self.hit(mx, my):
                if self.switch_status:
                    self.status = button_status.ON
                    draw.rect_color(self.rect, self.co)
                else:
                    self.status = button_status.HIGHLIGHTED
                    draw.rect_color(self.rect, self.ch)
            else:
                if self.switch_status:
                    self.status = button_status.ON
                    draw.rect_color(self.rect, self.co)
                else:
                    self.status = button_status.NORMAL
                    draw.rect_color(self.rect, self.c)
        else:
            # not switch!
            if self.hit(mx, my):
                self.status = button_status.HIGHLIGHTED
                draw.rect_color(self.rect, self.ch)
            else:
                self.status = button_status.NORMAL
                draw.rect_color(self.rect, self.c)