-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtktest.py
More file actions
executable file
·51 lines (36 loc) · 1.19 KB
/
tktest.py
File metadata and controls
executable file
·51 lines (36 loc) · 1.19 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
from tkinter import Tk, RIGHT, BOTH, RAISED
from tkinter.ttk import Frame, Button, Style
class Example(Frame):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.master.title("Simple")
self.style = Style()
# self.style.configure("TFrame", background="#333")
print(self.style.theme_names())
# self.style.theme_use("clam")
frame = Frame(self, relief=RAISED, borderwidth=1)
frame.pack(fill=BOTH, expand=True)
self.pack(fill=BOTH, expand=1)
self.centerWindow()
progButton = Button(self, text="Program")
progButton.pack(side=RIGHT)
closeButton = Button(self, text="Close")
closeButton.pack(side=RIGHT, padx=5, pady=5)
okButton = Button(self, text="OK")
okButton.pack(side=RIGHT)
def centerWindow(self):
w = 600
h = 400
sw = self.master.winfo_screenwidth()
sh = self.master.winfo_screenheight()
x = (sw - w) / 2
y = (sh - h) / 2
self.master.geometry('%dx%d+%d+%d' % (w, h, x, y))
def main():
root = Tk()
app = Example()
root.mainloop()
if __name__ == '__main__':
main()