This document explains how to use themes and how to change theme-related defaults in TkEasyGUI.
TkEasyGUI uses ttk themes for modern widget rendering.
You can switch themes at runtime using set_theme() or theme().
Default theme by platform:
- macOS:
aqua - Windows:
vista - Linux/others:
clam
import TkEasyGUI as eg
eg.set_theme("clam")
window = eg.Window("Theme sample", [[eg.Button("OK", use_ttk_buttons=True)]])
window.read()
window.close()theme() is an alias of set_theme().
import TkEasyGUI as eg
eg.theme("default")Use get_themes() to inspect themes available in your current Tk runtime.
import TkEasyGUI as eg
print(eg.get_themes())Note:
get_themes()is the preferred API name.get_tnemes()is still available as a backward-compatible alias.
Button can render with ttk.Button (modern) or tk.Button (classic).
use_ttk_buttons=True(default): usettk.Buttonuse_ttk_buttons=False: usetk.Button
import TkEasyGUI as eg
layout = [
[eg.Button("Modern", use_ttk_buttons=True)],
[eg.Button("Classic", use_ttk_buttons=False)],
]
window = eg.Window("Buttons", layout)
window.read()
window.close()Note:
- If you set
use_ttk_buttons=True, explicit button height settings are ignored. - This is a limitation of
ttk. - If you need to control button height, use
use_ttk_buttons=False.
If you want to change the default theme for your app, call set_theme() before creating windows.
import TkEasyGUI as eg
eg.set_theme("winnative")If you want behavior close to older Windows appearance:
import TkEasyGUI as eg
eg.set_theme("vista")
layout = [[eg.Button("OK", use_ttk_buttons=False)]]
window = eg.Window("Legacy look", layout)
window.read()
window.close()After changing theme defaults, validate with:
python tests/file_viewer.py
python tests/theme/ttk_button.py
python tests/ui_test.py
python tests/many_buttons.py