Nice GUI graphic for tkinter with ttk and azure theme from this guy

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.

azure ttk theme

This guy made this nice theme for ttk. Look at his reddit post here and the github repository I forked here.

Accent and Toggle button
switch

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
Avatar My youtube channel

Twitter: @pythonprogrammi - python_pygame

Videos

Speech recognition game

Pygame's Platform Game

Other Pygame's posts

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.