-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (37 loc) · 1.47 KB
/
main.py
File metadata and controls
50 lines (37 loc) · 1.47 KB
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
import customtkinter as ctk
from ui.content import MainContent
from ui.sidebar import Sidebar
import utils.helper as helper
class App(ctk.CTk):
def __init__(self):
super().__init__()
self.title("Hypixel Skyblock Damage Calculator")
self.geometry(f"{helper.WIDTH}x{helper.HEIGHT}")
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=0)
self.grid_columnconfigure(1, weight=0)
self.grid_columnconfigure(2, weight=1)
self.sidebar = Sidebar(self, self.show_content, self.change_appearance_mode)
self.sidebar.grid(row=0, column=0, sticky="nsew")
self.divider = ctk.CTkFrame(self, width=5, corner_radius=0, fg_color=("#c8ccd2", "#2c2c2c"))
self.divider.grid(row=0, column=1, sticky="ns")
self.contents = {
"melee": self.create_content_frame(),
"magic": self.create_content_frame(),
}
self.current_content = None
self.show_content("melee")
def change_appearance_mode(self, value):
ctk.set_appearance_mode(value)
def create_content_frame(self):
frame = MainContent(self)
return frame
def show_content(self, name):
if self.current_content:
self.current_content.grid_remove()
frame = self.contents[name]
frame.grid(row=0, column=2, sticky="nsew")
self.current_content = frame
if __name__ == "__main__":
app = App()
app.mainloop()