-
Notifications
You must be signed in to change notification settings - Fork 0
/
cancelreserv.py
288 lines (242 loc) · 11 KB
/
cancelreserv.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
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#! /usr/bin/env python
#
# GUI module generated by PAGE version 4.7
# In conjunction with Tcl version 8.6
# Apr 24, 2016 02:42:09 AM
import sys
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = 0
except ImportError:
import tkinter.ttk as ttk
py3 = 1
import cancelreserv_support
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
root = Tk()
top = Cancel_Reservation (root)
cancelreserv_support.init(root, top)
root.mainloop()
w = None
def create_Cancel_Reservation(root, *args, **kwargs):
'''Starting point when module is imported by another program.'''
global w, w_win, rt
rt = root
w = Toplevel (root)
top = Cancel_Reservation (w)
cancelreserv_support.init(w, top, *args, **kwargs)
return (w, top)
def destroy_Cancel_Reservation():
global w
w.destroy()
w = None
class Cancel_Reservation:
def __init__(self, top=None):
'''This class configures and populates the toplevel window.
top is the toplevel containing window.'''
_bgcolor = '#d9d9d9' # X11 color: 'gray85'
_fgcolor = '#000000' # X11 color: 'black'
_compcolor = '#d9d9d9' # X11 color: 'gray85'
_ana1color = '#d9d9d9' # X11 color: 'gray85'
_ana2color = '#d9d9d9' # X11 color: 'gray85'
font10 = "-family {DejaVu Sans} -size 20 -weight normal -slant" \
" roman -underline 0 -overstrike 0"
self.style = ttk.Style()
if sys.platform == "win32":
self.style.theme_use('winnative')
self.style.configure('.',background=_bgcolor)
self.style.configure('.',foreground=_fgcolor)
self.style.configure('.',font="TkDefaultFont")
self.style.map('.',background=
[('selected', _compcolor), ('active',_ana2color)])
top.geometry("672x450+264+146")
top.title("Cancel Reservation")
self.Label1 = Label(top)
self.Label1.place(relx=0.33, rely=0.04, height=33, width=244)
self.Label1.configure(font=font10)
self.Label1.configure(foreground="#ffc800")
self.Label1.configure(highlightcolor="#ffe400")
self.Label1.configure(text='''Cancel Reservation''')
self.Label2 = Label(top)
self.Label2.place(relx=0.15, rely=0.27, height=18, width=87)
self.Label2.configure(text='''ReservationID''')
self.Entry1 = Entry(top)
self.Entry1.place(relx=0.3, rely=0.27, relheight=0.04, relwidth=0.22)
self.Entry1.configure(background="white")
self.Entry1.configure(font="TkFixedFont")
self.Button1 = Button(top)
self.Button1.place(relx=0.57, rely=0.27, height=26, width=68)
self.Button1.configure(activebackground="#d9d9d9")
self.Button1.configure(text='''Search''')
self.Button2 = Button(top)
self.Button2.place(relx=0.21, rely=0.4, height=26, width=55)
self.Button2.configure(activebackground="#d9d9d9")
self.Button2.configure(text='''Back''')
self.Frame1 = Frame(top)
self.Frame1.place(relx=0.01, rely=0.16, relheight=0.72, relwidth=0.96)
self.Frame1.configure(relief=GROOVE)
self.Frame1.configure(borderwidth="2")
self.Frame1.configure(relief=GROOVE)
self.Frame1.configure(width=645)
self.style.configure('Treeview.Heading', font="TkDefaultFont")
self.Scrolledtreeview1 = ScrolledTreeView(self.Frame1)
self.Scrolledtreeview1.place(relx=0.02, rely=0.06, relheight=0.52
, relwidth=0.97)
self.Scrolledtreeview1.configure(columns="Col1 Col2 Col3 Col4 Col5 Col6 Col7")
self.Scrolledtreeview1.heading("#0",text="Train")
self.Scrolledtreeview1.heading("#0",anchor="center")
self.Scrolledtreeview1.column("#0",width="93")
self.Scrolledtreeview1.column("#0",minwidth="20")
self.Scrolledtreeview1.column("#0",stretch="1")
self.Scrolledtreeview1.column("#0",anchor="w")
self.Scrolledtreeview1.heading("Col1",text="Time")
self.Scrolledtreeview1.heading("Col1",anchor="center")
self.Scrolledtreeview1.column("Col1",width="116")
self.Scrolledtreeview1.column("Col1",minwidth="20")
self.Scrolledtreeview1.column("Col1",stretch="1")
self.Scrolledtreeview1.column("Col1",anchor="w")
self.Scrolledtreeview1.heading("Col2",text="Departs")
self.Scrolledtreeview1.heading("Col2",anchor="center")
self.Scrolledtreeview1.column("Col2",width="100")
self.Scrolledtreeview1.column("Col2",minwidth="20")
self.Scrolledtreeview1.column("Col2",stretch="1")
self.Scrolledtreeview1.column("Col2",anchor="w")
self.Scrolledtreeview1.heading("Col3",text="Arrival")
self.Scrolledtreeview1.heading("Col3",anchor="center")
self.Scrolledtreeview1.column("Col3",width="98")
self.Scrolledtreeview1.column("Col3",minwidth="20")
self.Scrolledtreeview1.column("Col3",stretch="1")
self.Scrolledtreeview1.column("Col3",anchor="w")
self.Scrolledtreeview1.heading("Col4",text="Class")
self.Scrolledtreeview1.heading("Col4",anchor="center")
self.Scrolledtreeview1.column("Col4",width="46")
self.Scrolledtreeview1.column("Col4",minwidth="20")
self.Scrolledtreeview1.column("Col4",stretch="1")
self.Scrolledtreeview1.column("Col4",anchor="w")
self.Scrolledtreeview1.heading("Col5",text="Price")
self.Scrolledtreeview1.heading("Col5",anchor="center")
self.Scrolledtreeview1.column("Col5",width="49")
self.Scrolledtreeview1.column("Col5",minwidth="20")
self.Scrolledtreeview1.column("Col5",stretch="1")
self.Scrolledtreeview1.column("Col5",anchor="w")
self.Scrolledtreeview1.heading("Col6",text="#bags")
self.Scrolledtreeview1.heading("Col6",anchor="center")
self.Scrolledtreeview1.column("Col6",width="40")
self.Scrolledtreeview1.column("Col6",minwidth="20")
self.Scrolledtreeview1.column("Col6",stretch="1")
self.Scrolledtreeview1.column("Col6",anchor="w")
self.Scrolledtreeview1.heading("Col7",text="name")
self.Scrolledtreeview1.heading("Col7",anchor="center")
self.Scrolledtreeview1.column("Col7",width="70")
self.Scrolledtreeview1.column("Col7",minwidth="20")
self.Scrolledtreeview1.column("Col7",stretch="1")
self.Scrolledtreeview1.column("Col7",anchor="w")
self.Label3 = Label(self.Frame1)
self.Label3.place(relx=0.08, rely=0.62, height=18, width=151)
self.Label3.configure(text='''Total cost of Reservation''')
self.Label4 = Label(self.Frame1)
self.Label4.place(relx=0.09, rely=0.71, height=18, width=124)
self.Label4.configure(text='''Date of Cancellation''')
self.Label5 = Label(self.Frame1)
self.Label5.place(relx=0.09, rely=0.8, height=18, width=126)
self.Label5.configure(text='''Amt to be Refunded''')
self.Text1 = Text(self.Frame1)
self.Text1.place(relx=0.33, rely=0.62, relheight=0.07, relwidth=0.15)
self.Text1.configure(background="white")
self.Text1.configure(font="TkTextFont")
self.Text1.configure(selectbackground="#c4c4c4")
self.Text1.configure(width=96)
self.Text1.configure(wrap=WORD)
self.Text2 = Text(self.Frame1)
self.Text2.place(relx=0.33, rely=0.71, relheight=0.07, relwidth=0.15)
self.Text2.configure(background="white")
self.Text2.configure(font="TkTextFont")
self.Text2.configure(selectbackground="#c4c4c4")
self.Text2.configure(width=96)
self.Text2.configure(wrap=WORD)
self.Text3 = Text(self.Frame1)
self.Text3.place(relx=0.33, rely=0.8, relheight=0.07, relwidth=0.15)
self.Text3.configure(background="white")
self.Text3.configure(font="TkTextFont")
self.Text3.configure(selectbackground="#c4c4c4")
self.Text3.configure(width=96)
self.Text3.configure(wrap=WORD)
self.Button3 = Button(self.Frame1)
self.Button3.place(relx=0.16, rely=0.89, height=26, width=55)
self.Button3.configure(activebackground="#d9d9d9")
self.Button3.configure(text='''Back''')
self.Button4 = Button(self.Frame1)
self.Button4.place(relx=0.34, rely=0.89, height=26, width=70)
self.Button4.configure(activebackground="#d9d9d9")
self.Button4.configure(text='''Submit''')
# The following code is added to facilitate the Scrolled widgets you specified.
class AutoScroll(object):
'''Configure the scrollbars for a widget.'''
def __init__(self, master):
# Rozen. Added the try-except clauses so that this class
# could be used for scrolled entry widget for which vertical
# scrolling is not supported. 5/7/14.
try:
vsb = ttk.Scrollbar(master, orient='vertical', command=self.yview)
except:
pass
hsb = ttk.Scrollbar(master, orient='horizontal', command=self.xview)
#self.configure(yscrollcommand=self._autoscroll(vsb),
# xscrollcommand=self._autoscroll(hsb))
try:
self.configure(yscrollcommand=self._autoscroll(vsb))
except:
pass
self.configure(xscrollcommand=self._autoscroll(hsb))
self.grid(column=0, row=0, sticky='nsew')
try:
vsb.grid(column=1, row=0, sticky='ns')
except:
pass
hsb.grid(column=0, row=1, sticky='ew')
master.grid_columnconfigure(0, weight=1)
master.grid_rowconfigure(0, weight=1)
# Copy geometry methods of master (taken from ScrolledText.py)
if py3:
methods = Pack.__dict__.keys() | Grid.__dict__.keys() \
| Place.__dict__.keys()
else:
methods = Pack.__dict__.keys() + Grid.__dict__.keys() \
+ Place.__dict__.keys()
for meth in methods:
if meth[0] != '_' and meth not in ('config', 'configure'):
setattr(self, meth, getattr(master, meth))
@staticmethod
def _autoscroll(sbar):
'''Hide and show scrollbar as needed.'''
def wrapped(first, last):
first, last = float(first), float(last)
if first <= 0 and last >= 1:
sbar.grid_remove()
else:
sbar.grid()
sbar.set(first, last)
return wrapped
def __str__(self):
return str(self.master)
def _create_container(func):
'''Creates a ttk Frame with a given master, and use this new frame to
place the scrollbars and the widget.'''
def wrapped(cls, master, **kw):
container = ttk.Frame(master)
return func(cls, container, **kw)
return wrapped
class ScrolledTreeView(AutoScroll, ttk.Treeview):
'''A standard ttk Treeview widget with scrollbars that will
automatically show/hide as needed.'''
@_create_container
def __init__(self, master, **kw):
ttk.Treeview.__init__(self, master, **kw)
AutoScroll.__init__(self, master)
if __name__ == '__main__':
vp_start_gui()