-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmainWindow.py
More file actions
89 lines (72 loc) · 4.12 KB
/
mainWindow.py
File metadata and controls
89 lines (72 loc) · 4.12 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
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
from tkinter import *
import addEmpWindow
import addDepWindow
import editEmpWindow
import editDepWindow
import loginWindow
import depLeader
import manager
import executive
def on_enter(button):
button.config(background="#B0E2FF")
def on_leave(button):
button.config(background= "#87CEFF")
class mainWindow():
def __init__(self, pos):
self.pos = pos
self.root = Toplevel()
self.root.title("Excrucia Inc.")
self.root.geometry("800x800")
self.root.minsize(800, 600)
self.root.maxsize(800, 600)
self.bg = PhotoImage(file = "mainbackground.png")
self.canvas = Canvas(self.root, width = 800, height = 600)
self.canvas.pack(fill = "both", expand = True)
self.canvas.create_image(0, 0, image = self.bg, anchor = "nw")
self.text1 = Label(self.root, bg = "#87CEFA", fg = "#FFFFFF", text = "Welcome!", font = ("Arial Bold", 28))
self.canvas.create_window(400, 50, window = self.text1)
self.addEmpB = Button(self.root, bd = 1, bg = "#87CEFF", fg = "#FFFFFF", activebackground = "#B0E2FF", activeforeground = "#FFFFFF", font = ("Arial Bold", 18),
text ="Add employee", width = 20, command = self.addEmp)
self.addEmpB.bind('<Enter>', lambda event: on_enter(self.addEmpB))
self.addEmpB.bind('<Leave>', lambda event: on_leave(self.addEmpB))
self.canvas.create_window(200, 200, window = self.addEmpB)
self.editEmpB = Button(self.root, bd = 1, bg = "#87CEFF", fg = "#FFFFFF", activebackground = "#B0E2FF", activeforeground = "#FFFFFF", font = ("Arial Bold", 18),
text ="View employee info", width = 20, command = self.editEmp)
self.editEmpB.bind('<Enter>', lambda event: on_enter(self.editEmpB))
self.editEmpB.bind('<Leave>', lambda event: on_leave(self.editEmpB))
self.canvas.create_window(600, 200, window = self.editEmpB)
self.addDepB = Button(self.root, bd = 1, bg = "#87CEFF", fg = "#FFFFFF", activebackground = "#B0E2FF", activeforeground = "#FFFFFF", font = ("Arial Bold", 18),
text ="Add department", width = 20, command = addDep)
self.addDepB.bind('<Enter>', lambda event: on_enter(self.addDepB))
self.addDepB.bind('<Leave>', lambda event: on_leave(self.addDepB))
self.canvas.create_window(200, 300, window = self.addDepB)
self.editDepB = Button(self.root, bd = 1, bg = "#87CEFF", fg = "#FFFFFF", activebackground = "#B0E2FF", activeforeground = "#FFFFFF", font = ("Arial Bold", 18),
text ="View department info", width = 20, command = editDep)
self.editDepB.bind('<Enter>', lambda event: on_enter(self.editDepB))
self.editDepB.bind('<Leave>', lambda event: on_leave(self.editDepB))
self.canvas.create_window(600, 300, window = self.editDepB)
self.logOutB = Button(self.root, bd = 1, bg = "#87CEFF", fg = "#FFFFFF", activebackground = "#B0E2FF", activeforeground = "#FFFFFF", font = ("Arial Bold", 18),
text ="Log out", width = 20, command = self.logOut)
self.logOutB.bind('<Enter>', lambda event: on_enter(self.logOutB))
self.logOutB.bind('<Leave>', lambda event: on_leave(self.logOutB))
self.canvas.create_window(400, 400, window = self.logOutB)
self.root.mainloop()
def addEmp():
ae = addEmpWindow.addWindow()
def editEmp():
editEmpWindow.editEmpWindow()
def addDep():
if self.pos == "executive":
adw = addDepWindow.addWindow()
else:
messagebox.showerror("error", "Permission denied!")
def editDep():
if self.pos == "executive":
editDepWindow.editDepWindow()
else:
messagebox.showerror("error", "Permission denied!")
def logOut(self):
command = self.root.destroy()
lw = loginWindow.loginWindow()
#if __name__ == "__main__":
# mainWindow()