testtheme.py gelöscht
This commit is contained in:
parent
3102c685fd
commit
63ed0abc98
27
testtheme.py
27
testtheme.py
@ -1,27 +0,0 @@
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
root = tk.Tk()
|
||||
|
||||
# Pack a big frame so, it behaves like the window background
|
||||
big_frame = ttk.Frame(root)
|
||||
big_frame.pack(fill="both", expand=True)
|
||||
|
||||
# Set the initial theme
|
||||
root.tk.call("source", "TK-Themes/azure.tcl")
|
||||
root.tk.call("set_theme", "light")
|
||||
|
||||
def change_theme():
|
||||
# NOTE: The theme's real name is azure-<mode>
|
||||
if root.tk.call("ttk::style", "theme", "use") == "azure-dark":
|
||||
# Set light theme
|
||||
root.tk.call("set_theme", "light")
|
||||
else:
|
||||
# Set dark theme
|
||||
root.tk.call("set_theme", "dark")
|
||||
|
||||
# Remember, you have to use ttk widgets
|
||||
button = ttk.Button(big_frame, text="Change theme!", command=change_theme)
|
||||
button.pack()
|
||||
|
||||
root.mainloop()
|
Loading…
Reference in New Issue
Block a user