You may know that I like tkinter, being my fav GUI module for python. It’s a buil in module, so you do not have to install anything to use it. The look of the widgets though may not be so ‘up-to-date‘ to the latest kind of style you may imagine.
This guy made this nice theme for ttk. Look at his reddit post here and the github repository I forked here.
Example of usage of azure theme
import tkinter as tk import tkinter.ttk as ttk root = tk.Tk() root.geometry("400x300") style = ttk.Style(root) root.tk.call('source', 'azure/azure.tcl') style.theme_use('azure') style.configure("Accentbutton", foreground='white') style.configure("Togglebutton", foreground='white') button = ttk.Button( root, text="Here I am - Accent", style="Accentbutton") button.pack() var = tk.StringVar() togglebutton = ttk.Checkbutton( root, text='Toggle button', style='Togglebutton', variable=var, onvalue=1) togglebutton.pack() var2 = tk.StringVar() togglebutton2 = ttk.Checkbutton( root, text='Switch button', variable=var2, onvalue=1, style="Switch") togglebutton2.pack() root.mainloop()
Example of changing color to an Entry if the input is invalid
def check_entry(): print(entry.get()) if "@" not in entryVar.get(): print("there is no @") entry.state(["invalid"]) print(entry.state()) entryVar = tk.StringVar() entry = ttk.Entry(root, textvariable=entryVar,) entry.place(x=250, y=20) entry.insert(0, 'Entry') button1 = ttk.Button(root, text="CHECK", command=check_entry) button1.place(x=350, y=20)
Subscribe to the newsletter for updates
Tkinter templates
My youtube channel
Twitter: @pythonprogrammi - python_pygame