-
-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathframescriptui.py
84 lines (74 loc) · 2.58 KB
/
framescriptui.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
#!/usr/bin/python3
import tkinter as tk
import tkinter.ttk as ttk
from pygubu.widgets.simpletooltip import Tooltip, Tooltipttk
#
# Begin i18n - Setup translator in derived class file
#
def i18n_noop(value):
return value
i18n_translator = i18n_noop
# End i18n
class FrameScriptUI:
def __init__(self, master=None, data_pool=None):
_ = i18n_translator # i18n string marker.
# build ui
frame2 = ttk.Frame(master)
frame2.configure(height=200, padding="10p", width=200)
labelframe1 = ttk.Labelframe(frame2)
labelframe1.configure(
height=200,
padding="10p",
text=_("Tooltip using tk.Label"),
width=200,
)
button1 = ttk.Button(labelframe1)
button1.configure(text=_("Default tooltip"), width=-15)
tooltip1 = Tooltip(button1)
tooltip1.configure(text=_("A simple tooltip for tkinter !"))
button1.pack(pady="0 10p", side="top")
button2 = ttk.Button(labelframe1)
button2.configure(text=_("Customized tooltip"), width=-15)
tooltip2 = Tooltip(button2)
tooltip2.configure(
background="#000074",
font="{Helvetica} 16 {}",
foreground="#d6ffff",
text=_("A tooltip configured for button 2!"),
)
button2.pack(side="top")
labelframe1.pack(padx="0 10p", side="left")
labelframe2 = ttk.Labelframe(frame2)
labelframe2.configure(
height=200,
padding="10p",
text=_("Tooltip using ttk.Label"),
width=200,
)
button3 = ttk.Button(labelframe2)
button3.configure(text=_("Default tooltip"), width=-15)
tooltipttk1 = Tooltipttk(button3)
tooltipttk1.configure(text=_("A simple tooltip for tkinter ttk !"))
button3.pack(pady="0 10p", side="top")
button4 = ttk.Button(labelframe2)
button4.configure(text=_("Customized tooltip"), width=-15)
tooltipttk2 = Tooltipttk(button4)
tooltipttk2.configure(
background="#d9b3d9",
borderwidth="2p",
font="{DejaVu Sans Mono} 14 {italic}",
foreground="#d90000",
relief="solid",
text=_("A tooltip configured for button 4!"),
)
button4.pack(side="top")
labelframe2.pack(side="left")
frame2.pack(expand=True, fill="both", side="top")
# Main widget
self.mainwindow = frame2
def run(self):
self.mainwindow.mainloop()
if __name__ == "__main__":
root = tk.Tk()
app = FrameScriptUI(root)
app.run()