Theme testing (not implemented)
This commit is contained in:
1 parent
77178b6b9d
commit
98451d9342
1 file changed
+20
-14
@@ -1227,30 +1227,36 @@ class GUIManager:
|
|||||||
root.bind_all("<KeyPress-Escape>", self.unfocus) # pressing ESC unfocuses selection
|
root.bind_all("<KeyPress-Escape>", self.unfocus) # pressing ESC unfocuses selection
|
||||||
|
|
||||||
# style adjustements
|
# style adjustements
|
||||||
self._style = ttk.Style(root)
|
self._style = style = ttk.Style(root)
|
||||||
|
# theme
|
||||||
|
theme = ''
|
||||||
|
# theme = style.theme_names()[6]
|
||||||
|
# style.theme_use(theme)
|
||||||
# fix treeview's background color from tags not working (also see '_fixed_map')
|
# fix treeview's background color from tags not working (also see '_fixed_map')
|
||||||
self._style.map(
|
style.map(
|
||||||
"Treeview",
|
"Treeview",
|
||||||
foreground=self._fixed_map("foreground"),
|
foreground=self._fixed_map("foreground"),
|
||||||
background=self._fixed_map("background"),
|
background=self._fixed_map("background"),
|
||||||
)
|
)
|
||||||
# remove Notebook.focus from the Notebook.Tab layout tree to avoid an ugly dotted line
|
# remove Notebook.focus from the Notebook.Tab layout tree to avoid an ugly dotted line
|
||||||
# on tab selection. We fold the Notebook.focus children into Notebook.padding children.
|
# on tab selection. We fold the Notebook.focus children into Notebook.padding children.
|
||||||
original = self._style.layout("TNotebook.Tab")
|
if theme != "classic":
|
||||||
sublayout = original[0][1]["children"][0][1]
|
original = style.layout("TNotebook.Tab")
|
||||||
sublayout["children"] = sublayout["children"][0][1]["children"]
|
sublayout = original[0][1]["children"][0][1]
|
||||||
self._style.layout("TNotebook.Tab", original)
|
sublayout["children"] = sublayout["children"][0][1]["children"]
|
||||||
|
style.layout("TNotebook.Tab", original)
|
||||||
# add padding to the tab names
|
# add padding to the tab names
|
||||||
self._style.configure("TNotebook.Tab", padding=[8, 4])
|
style.configure("TNotebook.Tab", padding=[8, 4])
|
||||||
# remove Checkbutton.focus dotted line from checkbuttons
|
# remove Checkbutton.focus dotted line from checkbuttons
|
||||||
self._style.configure("TCheckbutton", padding=0)
|
if theme != "classic":
|
||||||
original = self._style.layout("TCheckbutton")
|
style.configure("TCheckbutton", padding=0)
|
||||||
sublayout = original[0][1]["children"]
|
original = style.layout("TCheckbutton")
|
||||||
sublayout[1] = sublayout[1][1]["children"][0]
|
sublayout = original[0][1]["children"]
|
||||||
del original[0][1]["children"][1]
|
sublayout[1] = sublayout[1][1]["children"][0]
|
||||||
self._style.layout("TCheckbutton", original)
|
del original[0][1]["children"][1]
|
||||||
|
style.layout("TCheckbutton", original)
|
||||||
# adds a style with a larger font for buttons
|
# adds a style with a larger font for buttons
|
||||||
self._style.configure("Large.TButton", font=LARGE_FONT)
|
style.configure("Large.TButton", font=LARGE_FONT)
|
||||||
# end of style changes
|
# end of style changes
|
||||||
|
|
||||||
root_frame = ttk.Frame(root, padding=8)
|
root_frame = ttk.Frame(root, padding=8)
|
||||||
|
|||||||
Reference in new issue
Block a user