-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatenewwindow.py
More file actions
138 lines (118 loc) · 4.92 KB
/
Copy pathcreatenewwindow.py
File metadata and controls
138 lines (118 loc) · 4.92 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
# -*- coding: utf-8 -*-
import tkinter as tk
import tkinter.font as tkFont
import webbrowser
class CreateNewWindow():
def aboutDialog():
# create child window
win = tk.Toplevel()
# setting title
win.title("About")
# setting window size
width=300
height=200
screenwidth = win.winfo_screenwidth()
screenheight = win.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
win.geometry(alignstr)
win.resizable(width=False, height=False)
ft_t = tkFont.Font(family='cursive',size=14,weight='bold')
ft_v = tkFont.Font(family='cursive',size=12,weight='bold')
ft_b = tkFont.Font(family='cursive',size=10,weight='bold')
ft = tkFont.Font(family='cursive',size=10)
app_Name=tk.Label(win)
app_Name["anchor"] = "center"
app_Name["font"] = ft_t
app_Name["justify"] = "center"
app_Name["text"] = "Random Value Generator"
app_Name["relief"] = "flat"
app_Name.place(relx=0.5, y=25, anchor="center",width=250,height=40)
app_Version=tk.Label(win)
app_Version["font"] = ft_v
app_Version["justify"] = "center"
app_Version["text"] = "Version 0.1"
app_Version.place(relx=0.5, y=70, anchor="center", width=100, height=20)
dev_Name=tk.Label(win)
dev_Name["anchor"] = "center"
dev_Name["font"] = ft
dev_Name["justify"] = "center"
dev_Name["text"] = "Copyright © 2022 - Shuwn Hsu"
dev_Name.place(relx=0.5, y=90, anchor="center", width=190, height=20)
dev_Address=tk.Label(win)
dev_Address["font"] = ft_b
dev_Address["fg"] = "blue"
dev_Address["justify"] = "center"
dev_Address["fg"] = "#548DE2"
dev_Address["text"] = r"https://shuwn.dev/ →"
dev_Address.bind("<Button-1>", lambda e: CreateNewWindow.callback(r"https://shuwn.dev/"))
dev_Address.place(relx=0.5, y=120, anchor="center", width=130, height=20)
win_Close=tk.Button(win)
win_Close["bg"] = "#efefef"
win_Close["font"] = ft_b
win_Close["fg"] = "#000000"
win_Close["justify"] = "center"
win_Close["text"] = "Ok"
win_Close.place(relx=0.5, y=165, anchor="center",width=80, height=40)
win_Close["command"] = win.destroy
def warningWin(txt):
win = tk.Toplevel()
win.title("Warning")
width=300
height=200
screenwidth = win.winfo_screenwidth()
screenheight = win.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
win.geometry(alignstr)
win.resizable(width=False, height=False)
ft_v = tkFont.Font(family='cursive',size=14,weight='bold')
ft_b = tkFont.Font(family='cursive',size=12,weight='bold')
warning_txt=tk.Label(win)
warning_txt["font"] = ft_v
warning_txt["justify"] = "center"
warning_txt["text"] = txt
warning_txt.place(relx=0.5, y=70, anchor="center", width=200, height=40)
win_Close=tk.Button(win)
win_Close["bg"] = "#efefef"
win_Close["font"] = ft_b
win_Close["justify"] = "center"
win_Close["text"] = "Ok"
win_Close.place(relx=0.5, y=165, anchor="center",width=80, height=40)
win_Close["command"] = win.destroy
def SaveWin(txt):
win = tk.Toplevel()
win.title("")
width=380
height=180
screenwidth = win.winfo_screenwidth()
screenheight = win.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
win.geometry(alignstr)
win.resizable(width=False, height=False)
ft_t = tkFont.Font(family='cursive',size=16,weight='bold')
ft_m = tkFont.Font(family='cursive',size=14)
ft_b = tkFont.Font(family='cursive',size=12,weight='bold')
title_txt=tk.Label(win)
title_txt["font"] = ft_t
title_txt["justify"] = "center"
title_txt["text"] = "Saved!"
title_txt.place(relx=0.5, y=40, anchor="center", width=350, height=40)
Message_txt=tk.Label(win)
Message_txt["font"] = ft_m
Message_txt["justify"] = "center"
Message_txt["text"] = txt
Message_txt.place(relx=0.5, y=80, anchor="center", width=350, height=40)
win_Close=tk.Button(win)
win_Close["bg"] = "#efefef"
win_Close["font"] = ft_b
win_Close["fg"] = "#000000"
win_Close["justify"] = "center"
win_Close["text"] = "Ok"
win_Close.place(relx=0.5, y=140, anchor="center",width=80, height=40)
win_Close["command"] = win.destroy
def callback(url):
webbrowser.open_new(url)
if __name__ == "__main__":
root = tk.Tk()
root.withdraw()
CreateNewWindow.aboutDialog()
tk.mainloop()