-
Notifications
You must be signed in to change notification settings - Fork 35
/
gui_example.py
40 lines (31 loc) · 1.07 KB
/
gui_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'''
gui_example.py
An example of opening the GUI.
'''
import sys
import time
from collections import defaultdict
from PyQt5.QtWidgets import QApplication
from maze import Maze, Game, game_repeater
from goodies import RandomGoody
from baddies import RandomBaddy
from gui import GameViewer
EXAMPLE_MAZE = Maze(10, 10, "0001010000"
"0111010101"
"0100000011"
"0110100010"
"0000100110"
"1111100000"
"0000001000"
"1000111010"
"0010001010"
"1100101010")
def gui_example():
''' Opens a GUI, allowing games to be stepped through or quickly played one after another '''
app = QApplication.instance() or QApplication(sys.argv)
gv = GameViewer()
gv.show()
gv.set_game_generator(game_repeater(EXAMPLE_MAZE * (3, 3), RandomGoody, RandomGoody, RandomBaddy))
app.exec_()
if __name__ == "__main__":
gui_example()