-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
66 lines (54 loc) · 1.77 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
import tkinter as tk
from login import *
from home import *
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
class App(ttk.Window):
def __init__(self):
super().__init__(themename = "darkly")
self.resizable(0,0)
self.attributes('-toolwindow',True)
self.container = ttk.Frame(self)
self.canvas = ttk.Canvas(self.container)
self.scrollbar = ttk.Scrollbar(self.container, orient = 'vertical', command = self.canvas.yview)
self.scrollbar.pack(side = 'left', fill = 'y')
self.canvas.pack(side = 'right', fill = 'both')
self.canvas.configure(yscrollcommand = self.scrollbar.set)
self.container.pack( fill = 'both', expand = True)
self.canvas.pack(side = 'right', fill = 'both', expand = True)
self.frames = {
Login : 'Login',
Create : 'Create',
Home : 'Home',
List: '',
}
self.showFrame(Login)
def showFrame(self,cont):
self.frame = cont(self, self.canvas)
self.frames[List] = db.title
if self.frames[cont] in ['Home', db.title]:
self.attributes('-toolwindow', False)
self.geometry('500x700')
self.canvas.configure(height = 700, width = 500)
else:
self.frame.pack(fill = 'both', expand = True)
self.frame.update()
self.canvas.configure(height = self.frame.winfo_reqheight(), width = self.frame.winfo_reqwidth())
self.frame.pack(fill = 'both', expand = True)
self.frame.update()
self.frame.bind(
'<Configure>',
lambda e: self.canvas.configure(
scrollregion = self.canvas.bbox('all')
)
)
self.canvas.create_window((0,0), window = self.frame, anchor = 'nw',)
self.title(self.frames[cont])
def delFrame(self,cont):
self.frame.pack_forget()
self.canvas.delete('all')
self.showFrame(cont)
if __name__ == '__main__':
app = App()
app.eval('tk::PlaceWindow . center')
app.mainloop()