-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibrary_selector.py
136 lines (118 loc) · 5.5 KB
/
library_selector.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
#---------------------------------------------------------------------------#
# #
# AngelReader Library Selector #
# Copyright (C) 2018 D.A.E. ([email protected]) #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <https://www.gnu.org/licenses/>. #
# #
#---------------------------------------------------------------------------#
# AngelReader Library Selector
# Date: October 02, 2018. 3:17am
# Author: D.A.E. ([email protected])
import tkinter as tk
root = tk.Tk()
root.config(bg="light cyan")
root.title("ANGEL READER LIBRARY SELECTOR | DAE-MAN PROJECT")
root.iconbitmap('icons/angel_icon.ico')
# Functions initialized
def select_library():
if variable.get() == "James Allen Library 1":
import angel_reader_allen_release
angel_reader_allen_release.open_lib()
elif variable.get() == "Wallace D. Wattles Library":
import angel_reader_wattles_release
angel_reader_wattles_release.open_lib()
elif variable.get() == "KJV NT Collection":
import angel_reader_kjvnt
angel_reader_kjvnt.open_lib()
def show_about():
global l_title, tframe_occupied, l_frame
if ab_variable.get() == "Angel Reader License":
if tframe_occupied == False:
l_title = title_1
get_frame()
tframe_occupied = True
else:
l_frame.destroy()
l_title = title_1
get_frame()
elif ab_variable.get() == "The DAE-MAN Project":
if tframe_occupied == False:
l_title = title_2
get_frame()
tframe_occupied = True
else:
l_frame.destroy()
l_title = title_2
get_frame()
def get_frame():
global l_title, l_frame
l_frame = tk.Frame(root, bd=2, relief=tk.SUNKEN)
# Text widget for the license text
lic_txt = tk.Text(l_frame, height=30, width=80, wrap=tk.WORD,
bg='light goldenrod', font='Courier 12 bold')
f_obj = open(l_title, encoding="utf8")
f_content = f_obj.read()
f_obj.close()
lic_txt.insert(tk.END, f_content)
lic_txt.config(state=tk.DISABLED) # text editing disabled
lic_txt.pack(side=tk.LEFT, fill=tk.X, padx=5)
# Scrollbar widget for the Text widget
s_bar = tk.Scrollbar(l_frame, orient=tk.VERTICAL, command=lic_txt.yview)
s_bar.pack()
lic_txt.configure(yscrollcommand=s_bar.set)
l_frame.pack(side=tk.TOP)
tframe_occupied = False
title_1 = 'docs/LICENSE.txt'
title_2 = 'docs/DAE-MAN.txt'
# Frame for the decor pix
img_frame = tk.Frame(root, bd=3, relief=tk.SUNKEN)
img_frame.pack(fill=tk.Y, side=tk.LEFT, padx=2, pady=2)
image = ['icons/angel_in_garden.png']
img_label = tk.Label(img_frame, bd=2, bg='ivory', relief=tk.RAISED)
img_label.pack(fill=tk.Y, side=tk.LEFT)
photo_image = tk.PhotoImage(file=image)
img_label['image'] = photo_image
# About button with frame
lbutton_frame = tk.Frame(root, bd=2)
lbutton_frame.pack(fill=tk.X, side=tk.BOTTOM)
l_button = tk.Button(lbutton_frame, text="About", fg='white', bg='turquoise4',
command=show_about)
l_button.pack(fill=tk.X)
# Selector button with frame
button_frame = tk.Frame(root, bd=2)
button_frame.pack(fill=tk.X, side=tk.BOTTOM)
selector_button = tk.Button(button_frame, text='Click To Load Library',
fg='white', bg='turquoise4', command=select_library)
selector_button.pack(fill=tk.X, side=tk.BOTTOM)
# Library menu with Label
menu_frame = tk.Frame(root, bd=3, bg='royalblue2', relief=tk.GROOVE)
menu_frame.pack(fill=tk.X, padx=2, pady=2)
variable = tk.StringVar(menu_frame)
variable.set("James Allen Library 1") # default value
tk.Label(menu_frame, bg='lawn green', fg='deep pink', text="Library Menu:").pack()
lib_option = tk.OptionMenu(menu_frame, variable, "James Allen Library 1", "Wallace D. Wattles Library",
"KJV NT Collection")
lib_option.config(bg="dark goldenrod", fg="white")
lib_option.pack()
# About menu with Label
ab_frame = tk.Frame(root, bd=3, bg='royalblue2', relief=tk.GROOVE)
ab_frame.pack(fill=tk.X, padx=2, pady=2)
ab_variable = tk.StringVar(ab_frame)
ab_variable.set("The DAE-MAN Project") # default value
tk.Label(ab_frame, bg='lawn green', fg='deep pink', text="About:").pack()
ab_option = tk.OptionMenu(ab_frame, ab_variable, "Angel Reader License", "The DAE-MAN Project")
ab_option.config(bg="dark goldenrod", fg="white")
ab_option.pack()
root.mainloop()