Пример #1
0
def keydown(key):
    x, y = g2d.mouse_position()
    g2d.set_color((randrange(256), randrange(256), randrange(256)))
    if x <= 25 and y <= 25 and g2d.confirm("Exit?"):
        g2d.close_canvas()
    else:
        g2d.fill_circle((x, y), 25)
Пример #2
0
def tick():
    if g2d.key_pressed("LeftButton"):
        x, y = g2d.mouse_position()
        g2d.set_color((randrange(256), randrange(256), randrange(256)))
        if x <= 25 and y <= 25 and g2d.confirm("Exit?"):
            g2d.close_canvas()
        else:
            g2d.fill_circle((x, y), 25)
Пример #3
0
def main():
    g2d.init_canvas((A, B))
    global players, rover2
    players = g2d.confirm("2 Giocatori?")
    print(players)
    if players:
        rover2 = Rover(arena, 200, B - 100)
    g2d.main_loop(update)
Пример #4
0
 def tick(self):
     if g2d.key_pressed("LeftButton"):
         self._downtime = time()
     elif g2d.key_released("LeftButton"):
         mouse = g2d.mouse_position()
         x, y = mouse[0] // W, mouse[1] // H
         if 0<=mouse[0]<=W*self._game.cols() and 0<=mouse[1]<=H*self._game.rows():
             if time() - self._downtime > LONG_PRESS:
                 self._game.flag_at(x, y)
             else:
                 self._game.play_at(x, y)
         self.update_buttons()
     elif g2d.key_pressed("h"):
         if g2d.confirm("Are You Sure? The autocompletion may not complete it (for wrong moves at the beginning). Are you sure you want to continue?"):
             self._game.help()
             #self._game.help_cirle()
             #self._game.help_square()
             self.update_buttons()