forked from cirion02/CelesteBingoCustomGen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
107 lines (68 loc) · 2.42 KB
/
main.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from tkinter import *
from tkinter.ttk import Combobox
import random
import generatorHandler
import bingoSyncConnection as bingosync
def execute():
if gameModeChoice.get() == "":
outputText("Please choose a gamemode option")
return
if submodeChoice.get() == "":
outputText("Please choose a submode option")
return
seed = seedBox.get()
if seed != "":
try:
seed = int(seed)
except ValueError():
seed = random.randint(0,999999)
else:
seed = random.randint(0,999999)
board = generatorHandler.generate(gameModeChoice.get(), submodeChoice.get(), str(seed))
password = passwordBox.get()
lockout = True if lockoutBox.get() else False
roomId = boardIdBox.get()
bingosync.joinRoom(roomId, password)
bingosync.setBoard(roomId, lockout, board)
bingosync.sendMessage(roomId, f"Changed the board to {gameModeChoice.get()} ({submodeChoice.get()})")
outputText("Succesfull (probably, haven't coded error handling)")
def outputText(text:str):
output["text"] = text
# UI stuff
window=Tk()
height = 400
width = 500
window.title('Celeste Bingo Custom Gen')
window.geometry(f"{width}x{height}+10+20")
lbl=Label(window, text="Celeste custom bingo gen", fg='Black', font=("Helvetica", 22))
lbl.place(x=(width-350)/2, y=20)
lbl=Label(window, text="Mode:", fg='black', font=("Helvetica", 12))
lbl.place(x=20, y=78)
gameModeChoice=Combobox(window, values=generatorHandler.gameModeSet)
gameModeChoice.place(x=80, y=80)
lbl=Label(window, text="Submode:", fg='black', font=("Helvetica", 12))
lbl.place(x=20, y=108)
submodeChoice=Combobox(window, values=generatorHandler.submodeSet)
submodeChoice.place(x=100, y=110)
lbl=Label(window, text="Lockout:", fg='black', font=("Helvetica", 12))
lbl.place(x=20, y=140)
lockoutBox = IntVar()
b=Checkbutton(window, variable=lockoutBox)
b.place(x=80, y=140)
lbl=Label(window, text="BoardId:", fg='black', font=("Helvetica", 12))
lbl.place(x=20, y=168)
boardIdBox=Entry(window)
boardIdBox.place(x=85, y=170)
lbl=Label(window, text="Password:", fg='black', font=("Helvetica", 12))
lbl.place(x=20, y=198)
passwordBox=Entry(window)
passwordBox.place(x=100, y=200)
lbl=Label(window, text="Seed:", fg='black', font=("Helvetica", 12))
lbl.place(x=20, y=228)
seedBox=Entry(window)
seedBox.place(x=100, y=230)
btn = Button(window, text="Generate", fg='black', command=execute)
btn.place(x=20, y=280)
output=Label(window, text="", fg='red', font=("Helvetica", 12))
output.place(x=20, y=310)
window.mainloop()