-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.py
49 lines (35 loc) · 1.32 KB
/
Menu.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
41
42
43
44
45
46
47
48
49
from tkinter import messagebox
from tkinter import *
from Game import Game
from threading import Thread
class Menu(Tk):
def __init__(self):
super().__init__(className=Game.WINDOW_TITLE)
homeFrame = Frame(self)
buttonsFrame = Frame(homeFrame)
playBTN = Button(buttonsFrame, text="Play", command=self.run_game, bg="red")
playBTN.pack(fill="x")
settingsBTN = Button(buttonsFrame, text="Settings", command=self.open_settings, bg="blue", fg="white")
settingsBTN.pack(fill="x")
buttonsFrame.grid()
homeFrame.rowconfigure(0, weight=1)
homeFrame.columnconfigure(0, weight=1)
homeFrame.grid(row=0, column=0, sticky="nesw")
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
w, h = self.winfo_screenwidth(), self.winfo_screenheight()
self.geometry("%dx%d+0+0" % (w, h))
def run_game(self):
self.withdraw()
gameThread = Thread(target=lambda: Game().run())
gameThread.start()
gameThread.join()
self.state('normal')
def open_settings(self):
messagebox.showinfo(message="Coming soon...")
pass
if __name__ == '__main__':
Menu().mainloop()
# dictLocals = vars(pygame.key)
# for key in dictLocals:
# print(key, dictLocals[key])