-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpeningFixedPage.py
More file actions
202 lines (165 loc) · 7.28 KB
/
OpeningFixedPage.py
File metadata and controls
202 lines (165 loc) · 7.28 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# This page was always fixed for left side bar
from tkinter import Frame, PhotoImage, Canvas, BOTH, YES
from os import getcwd
from tkinter import ttk
from tkinter import Tk
from PassAndVegUpdate import UpdateWindow
from Dealer import DealerPage
from Customer import customer
from BillingPage import Billing
pnges = ['ABN.png', 'Space.png',
"Dealer.png", "Billing.png", "Customer.png", "SpaceFill.png"]
change_pnges = ['ABN.png', 'Space1.png',
"DealerUp.png", "BillingUp.png", "CustomerUp.png", "SpaceFillUp.png"]
founationButtons = []
upperButtons = []
switching_func = []
position = getcwd()
# Fixed Opening Page
class FixedPage(Frame):
def __init__(self, parent, **kwargs):
Frame.__init__(self, parent, **kwargs)
self.parent = parent
self.parent.resizable(894, 649)
self.parent.geometry("894x649+200+200")
def LeftSideFixedPage(self):
self.FrameLeft = Frame(self, width=200, height=841)
self.FrameLeft.pack(side='left', anchor='w', fill='both')
self.CanvasLeft = Canvas(self.FrameLeft, width=200, height=850, borderwidth=10, background="#8E44AD")
self.CanvasLeft.pack(side='left', anchor='w', fill='both')
self.MenuOutLayout = PhotoImage(file=position + "/Requirements/MenuOut.png")
self.MenuOut = ttk.Label(self.CanvasLeft, image=self.MenuOutLayout)
self.MenuOut.image = self.MenuOutLayout
self.MenuOut.pack(side='left', anchor='w', fill='both')
self.FrameRight = Frame(self, width=1286,
height=841, background="#FDFEFE")
self.FrameRight.pack(fill='both', expand=True, anchor='n')
self.listlabel = []
self.ImageButtonPull()
def ImageButtonPull(self):
for first in range(len(pnges)):
for second in range(len(change_pnges)):
if first == second:
sidebarImages = PhotoImage(file=position+'/Requirements/'+pnges[first])
foundationLabels = ttk.Label(self.MenuOut, image=sidebarImages, background='#0077FF')
founationButtons.append(foundationLabels)
foundationLabels.image = sidebarImages
row = first
if founationButtons.index(foundationLabels) < 6:
foundationLabels.grid(row=row, column=0)
else:
pass
upperSidebarImages = PhotoImage(
file=position + "/Requirements/" + change_pnges[second])
upperLabels = ttk.Label(
self.MenuOut, image=upperSidebarImages, background='#64ACFE')
upperButtons.append(upperLabels)
upperLabels.image = upperSidebarImages
else:
pass
self.design()
def design(self):
def call_2(event):
upperButtons[2].grid_forget()
founationButtons[2].grid(row=2, column=0)
def call_3(event):
upperButtons[3].grid_forget()
founationButtons[3].grid(row=3, column=0)
def call_4(event):
upperButtons[4].grid_forget()
founationButtons[4].grid(row=4, column=0)
founationButtons[2].bind("<Enter>", lambda v: upperButtons[2].grid(row=2, column=0))
upperButtons[2].bind("<Leave>", call_2)
founationButtons[3].bind(
"<Enter>", lambda v: upperButtons[3].grid(row=3, column=0))
upperButtons[3].bind("<Leave>", call_3)
founationButtons[4].bind(
"<Enter>", lambda v: upperButtons[4].grid(row=4, column=0))
upperButtons[4].bind("<Leave>", call_4)
# upperButtons[3].bind("<Button-1>", self.stock_page)
upperButtons[2].bind("<Button-1>", self.DealerOpenFunc)
upperButtons[4].bind("<Button-1>", self.CustomerOpenFunc)
upperButtons[3].bind("<Button-1>", self.BillingOpenFunc)
founationButtons[0].bind("<Double-1>", self.PassAndVegUpdateFunc)
self.parent.protocol("WM_DELETE_WINDOW",
lambda: self.PassAndVegUpdateFunc("destroy"))
def PassAndVegUpdateFunc(self, event):
global anotherWindowForUpdate
if event != "destroy":
anotherWindowForUpdate = UpdateWindow()
anotherWindowForUpdate.WindowOfUpdate()
anotherWindowForUpdate.mainloop()
elif event == "destroy":
try:
self.parent.destroy()
anotherWindowForUpdate.destroy()
except: pass
def DealerOpenFunc(self, event):
self.design()
upperButtons[2].bind(
"<Leave>", lambda b: upperButtons[2].grid(in_=founationButtons[2]))
upperButtons[3].grid_forget()
upperButtons[4].grid_forget()
if 'add' in switching_func:
switching_func.remove("add")
self.connectDealer.destroy()
else:
pass
switching_func.append('add')
if "stock" in switching_func:
self.connectBilling.destroy()
switching_func.remove("stock")
elif "customer" in switching_func:
self.connectCustomer.destroy()
switching_func.remove("customer")
else:
pass
self.connectDealer = DealerPage(self.FrameRight)
self.connectDealer.pack(fill=BOTH, expand=YES)
self.connectDealer.PullComponents()
def CustomerOpenFunc(self, event):
self.design()
upperButtons[2].grid_forget()
upperButtons[3].grid_forget()
upperButtons[4].bind(
"<Leave>", lambda b: upperButtons[4].grid(in_=founationButtons[4]))
if 'customer' in switching_func:
switching_func.remove("customer")
self.connectCustomer.destroy()
else:
pass
switching_func.append("customer")
if "add" in switching_func:
switching_func.remove("add")
self.connectDealer.destroy()
elif "stock" in switching_func:
switching_func.remove("stock")
self.connectBilling.destroy()
else:
pass
self.connectCustomer = customer(self.FrameRight)
self.connectCustomer.pack(fill=BOTH, expand=YES)
self.connectCustomer.customerPage()
def BillingOpenFunc(self, event):
self.design()
upperButtons[2].grid_forget()
upperButtons[4].grid_forget()
upperButtons[3].bind(
"<Leave>", lambda b: upperButtons[4].grid(in_=founationButtons[4]))
if 'stock' in switching_func:
self.connectBilling.destroy()
switching_func.remove('stock')
else:
pass
switching_func.append("stock")
if "add" in switching_func:
switching_func.remove("add")
self.connectDealer.destroy()
elif "customer" in switching_func:
switching_func.remove("customer")
self.connectCustomer.destroy()
else:
pass
self.connectBilling = Billing(self.FrameRight)
self.connectBilling.pack(fill=BOTH, expand=YES)
self.connectBilling.billingPage()