Esempio n. 1
0
def main():
    """ The main application """
    gallows_hill = Pool(width = 800, height = 600)
    widget = HangmanWidget(gallows_hill)

    # check if the generated word contains the
    # guessed letter if any key was pressed
    gallows_hill.listen('<Key>', widget.attempt)

    # you can quit the game by clicking Ctrl+q or [Esc]
    gallows_hill.listen('<Key-Escape>', lambda e: gallows_hill.quit())
    gallows_hill.listen('<Control-Key-q>', lambda e: gallows_hill.quit())

    # start the mainloop
    gallows_hill.ready()
Esempio n. 2
0
    # move the frog and turn it, if necessary
    window.listen('<Shift-Key-Up>', move_callback)
    window.listen('<Shift-Key-Down>', move_callback)
    window.listen('<Shift-Key-Left>', move_callback)
    window.listen('<Shift-Key-Right>', move_callback)

    # turn the frog without moving it
    window.listen('<Control-Key-Up>', turn_callback)
    window.listen('<Control-Key-Down>', turn_callback)
    window.listen('<Control-Key-Left>', turn_callback)
    window.listen('<Control-Key-Right>', turn_callback)

    # "write" a dot with space
    window.listen('<space>', lambda event: frog.dot())

    # you can quit the game by clicking `q` or [Esc]
    window.listen('<Key-Escape>', lambda e: window.quit())
    window.listen('<Key-q>', lambda e: window.quit())


if __name__ == '__main__':
    # create a new field (the main window)
    window = Pool(width=800, height=600)

    main(window)
    #remote_control(window)

    # start the mainloop
    window.ready()
Esempio n. 3
0
def main():
    """ The main application """
    gallows_hill = Pool(width=800, height=600)
    widget = HangmanWidget(gallows_hill)

    # check if the generated word contains the
    # guessed letter if any key was pressed
    gallows_hill.listen('<Key>', widget.attempt)

    # you can quit the game by clicking Ctrl+q or [Esc]
    gallows_hill.listen('<Key-Escape>', lambda e: gallows_hill.quit())
    gallows_hill.listen('<Control-Key-q>', lambda e: gallows_hill.quit())

    # start the mainloop
    gallows_hill.ready()