-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
56 lines (47 loc) · 1.64 KB
/
app.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
import tkinter as tk
from pages.home import homePage
from pages.send import sendPage
from pages.extract import extractPage
from method.getConfig import getConfig
config = getConfig()
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title('文件')
self.resizable(0,0)
self.getConfig = config
self.setPosition()
self.initPage()
self.setMenu()
def setPosition(self):
screenwidth = self.winfo_screenwidth()
screenheight = self.winfo_screenheight()
# 程序窗口宽高
windowWidth = 600
windowHeight = 400
# 窗口位置
x = (screenwidth - windowWidth) / 2
y = (screenheight - windowHeight) / 2
self.geometry("%dx%d+%d+%d" %(windowWidth, windowHeight, x, y))
def setMenu(self):
menubar = tk.Menu(self)
menubar.add_command(label = "首页", command = lambda:self.changePage(1))
menubar.add_command(label = "发送", command = lambda:self.changePage(2))
menubar.add_command(label = "提取", command = lambda:self.changePage(3))
self.config(menu = menubar)
def initPage(self):
self.homePage = homePage(self)
self.sendPage = sendPage(self)
self.extractPage = extractPage(self)
self.changePage(1)
def changePage(self, index):
if index == 1:
self.homePage.lift()
elif index == 2:
self.sendPage.updateData()
self.sendPage.lift()
elif index == 3:
self.extractPage.lift()
app = App()
app.update()
app.mainloop()