-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenAboutBox.py.bak3
281 lines (250 loc) · 11.1 KB
/
GenAboutBox.py.bak3
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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 5.5
# in conjunction with Tcl version 8.6
# Oct 20, 2020 12:58:35 PM CEST platform: Windows NT
import sys
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
import GenAboutBox_support
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
root = tk.Tk()
top = About (root)
GenAboutBox_support.init(root, top)
root.mainloop()
w = None
def create_About(rt, *args, **kwargs):
'''Starting point when module is imported by another module.
Correct form of call: 'create_About(root, *args, **kwargs)' .'''
global w, w_win, root
#rt = root
root = rt
w = tk.Toplevel (root)
top = About (w)
GenAboutBox_support.init(w, top, *args, **kwargs)
return (w, top)
def destroy_About():
global w
w.destroy()
w = None
class About:
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 = '#ececec' # Closest X11 color: 'gray92'
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.map('.',background=
[('selected', _compcolor), ('active',_ana2color)])
top.geometry("459x535+341+118")
top.minsize(120, 1)
top.maxsize(1265, 770)
top.resizable(0, 0)
top.title("About")
top.configure(background="#d9d9d9")
top.configure(highlightbackground="#d9d9d9")
top.configure(highlightcolor="black")
self.lblProgName = tk.Label(top)
self.lblProgName.place(x=10, y=20, height=29, width=436)
self.lblProgName.configure(activebackground="#f9f9f9")
self.lblProgName.configure(activeforeground="black")
self.lblProgName.configure(background="#d9d9d9")
self.lblProgName.configure(disabledforeground="#a3a3a3")
self.lblProgName.configure(foreground="#000000")
self.lblProgName.configure(highlightbackground="#d9d9d9")
self.lblProgName.configure(highlightcolor="black")
self.lblProgName.configure(relief="sunken")
self.lblProgName.configure(text='''Label''')
self.lblVersion = tk.Label(top)
self.lblVersion.place(x=10, y=52, height=29, width=436)
self.lblVersion.configure(activebackground="#f9f9f9")
self.lblVersion.configure(activeforeground="black")
self.lblVersion.configure(background="#d9d9d9")
self.lblVersion.configure(disabledforeground="#a3a3a3")
self.lblVersion.configure(foreground="#000000")
self.lblVersion.configure(highlightbackground="#d9d9d9")
self.lblVersion.configure(highlightcolor="black")
self.lblVersion.configure(relief="sunken")
self.lblVersion.configure(text='''Label''')
self.lblAuthor = tk.Label(top)
self.lblAuthor.place(x=10, y=84, height=29, width=436)
self.lblAuthor.configure(activebackground="#f9f9f9")
self.lblAuthor.configure(activeforeground="black")
self.lblAuthor.configure(background="#d9d9d9")
self.lblAuthor.configure(disabledforeground="#a3a3a3")
self.lblAuthor.configure(foreground="#000000")
self.lblAuthor.configure(highlightbackground="#d9d9d9")
self.lblAuthor.configure(highlightcolor="black")
self.lblAuthor.configure(relief="sunken")
self.lblAuthor.configure(text='''Label''')
self.lblCopyright = tk.Label(top)
self.lblCopyright.place(x=10, y=110, height=29, width=436)
self.lblCopyright.configure(activebackground="#f9f9f9")
self.lblCopyright.configure(activeforeground="black")
self.lblCopyright.configure(background="#d9d9d9")
self.lblCopyright.configure(disabledforeground="#a3a3a3")
self.lblCopyright.configure(foreground="#000000")
self.lblCopyright.configure(highlightbackground="#d9d9d9")
self.lblCopyright.configure(highlightcolor="black")
self.lblCopyright.configure(relief="sunken")
self.lblCopyright.configure(text='''Label''')
self.Scrolledtext1 = ScrolledText(top)
self.Scrolledtext1.place(x=10, y=180, height=280, width=438)
self.Scrolledtext1.configure(background="white")
self.Scrolledtext1.configure(font="TkTextFont")
self.Scrolledtext1.configure(foreground="black")
self.Scrolledtext1.configure(highlightbackground="#d9d9d9")
self.Scrolledtext1.configure(highlightcolor="black")
self.Scrolledtext1.configure(insertbackground="black")
self.Scrolledtext1.configure(insertborderwidth="3")
self.Scrolledtext1.configure(selectbackground="#c4c4c4")
self.Scrolledtext1.configure(selectforeground="black")
self.Scrolledtext1.configure(wrap="word")
self.btnDismiss = tk.Button(top)
self.btnDismiss.place(x=130, y=470, height=37, width=177)
self.btnDismiss.configure(activebackground="#d9d9d9")
self.btnDismiss.configure(activeforeground="black")
self.btnDismiss.configure(background="#d9d9d9")
self.btnDismiss.configure(disabledforeground="#a3a3a3")
self.btnDismiss.configure(foreground="#000000")
self.btnDismiss.configure(highlightbackground="#d9d9d9")
self.btnDismiss.configure(highlightcolor="black")
self.btnDismiss.configure(pady="0")
self.btnDismiss.configure(text='''Dismiss''')
self.btnDismiss.bind('<Button-1>',lambda e:GenAboutBox_support.OnBtnDismiss(e))
self.lblHomepage = tk.Label(top)
self.lblHomepage.place(x=10, y=140, height=29, width=436)
self.lblHomepage.configure(activebackground="#f9f9f9")
self.lblHomepage.configure(activeforeground="black")
self.lblHomepage.configure(background="#d9d9d9")
self.lblHomepage.configure(disabledforeground="#a3a3a3")
self.lblHomepage.configure(foreground="#000000")
self.lblHomepage.configure(highlightbackground="#d9d9d9")
self.lblHomepage.configure(highlightcolor="#0000ff")
self.lblHomepage.configure(relief="sunken")
self.lblHomepage.configure(text='''Label''')
self.lblHomepage.bind('<Button-1>',lambda e:GenAboutBox_support.lblHomepage_LeftClick(url))
# 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)
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 = tk.Pack.__dict__.keys() | tk.Grid.__dict__.keys() \
| tk.Place.__dict__.keys()
else:
methods = tk.Pack.__dict__.keys() + tk.Grid.__dict__.keys() \
+ tk.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)
container.bind('<Enter>', lambda e: _bound_to_mousewheel(e, container))
container.bind('<Leave>', lambda e: _unbound_to_mousewheel(e, container))
return func(cls, container, **kw)
return wrapped
class ScrolledText(AutoScroll, tk.Text):
'''A standard Tkinter Text widget with scrollbars that will
automatically show/hide as needed.'''
@_create_container
def __init__(self, master, **kw):
tk.Text.__init__(self, master, **kw)
AutoScroll.__init__(self, master)
import platform
def _bound_to_mousewheel(event, widget):
child = widget.winfo_children()[0]
if platform.system() == 'Windows' or platform.system() == 'Darwin':
child.bind_all('<MouseWheel>', lambda e: _on_mousewheel(e, child))
child.bind_all('<Shift-MouseWheel>', lambda e: _on_shiftmouse(e, child))
else:
child.bind_all('<Button-4>', lambda e: _on_mousewheel(e, child))
child.bind_all('<Button-5>', lambda e: _on_mousewheel(e, child))
child.bind_all('<Shift-Button-4>', lambda e: _on_shiftmouse(e, child))
child.bind_all('<Shift-Button-5>', lambda e: _on_shiftmouse(e, child))
def _unbound_to_mousewheel(event, widget):
if platform.system() == 'Windows' or platform.system() == 'Darwin':
widget.unbind_all('<MouseWheel>')
widget.unbind_all('<Shift-MouseWheel>')
else:
widget.unbind_all('<Button-4>')
widget.unbind_all('<Button-5>')
widget.unbind_all('<Shift-Button-4>')
widget.unbind_all('<Shift-Button-5>')
def _on_mousewheel(event, widget):
if platform.system() == 'Windows':
widget.yview_scroll(-1*int(event.delta/120),'units')
elif platform.system() == 'Darwin':
widget.yview_scroll(-1*int(event.delta),'units')
else:
if event.num == 4:
widget.yview_scroll(-1, 'units')
elif event.num == 5:
widget.yview_scroll(1, 'units')
def _on_shiftmouse(event, widget):
if platform.system() == 'Windows':
widget.xview_scroll(-1*int(event.delta/120), 'units')
elif platform.system() == 'Darwin':
widget.xview_scroll(-1*int(event.delta), 'units')
else:
if event.num == 4:
widget.xview_scroll(-1, 'units')
elif event.num == 5:
widget.xview_scroll(1, 'units')
if __name__ == '__main__':
vp_start_gui()