-
Notifications
You must be signed in to change notification settings - Fork 0
/
chadt.py
54 lines (37 loc) · 1.34 KB
/
chadt.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
import logging as log
from tkinter import Button, Tk, Toplevel
from tkinter.messagebox import askokcancel
from client.client_view_controller import ClientViewController
from server.server_view_controller import ServerViewController
class LaunchWindow:
def __init__(self):
self.root = None
self.main_window = None
self.child_controllers = []
def start_tkinter(self):
self.root = Tk()
self.root.withdraw()
def start_window(self):
self.main_window = Toplevel()
self.main_window.title("Chadt")
self.main_window.protocol("WM_DELETE_WINDOW", self.quit)
server_button = Button(self.main_window, text="Create Server", command=self.create_server)
client_button = Button(self.main_window, text="Create Client", command=self.create_client)
server_button.grid(row=0, column=0)
client_button.grid(row=0, column=1)
self.root.mainloop()
def quit(self):
self.main_window.destroy()
def create_server(self):
s = ServerViewController()
s.start_controller()
def create_client(self):
c = ClientViewController()
c.start_controller()
def main():
l = LaunchWindow()
l.start_tkinter()
l.start_window()
if __name__ == "__main__":
log.basicConfig(level=log.DEBUG)
main()