• Stars
    star
    539
  • Rank 82,402 (Top 2 %)
  • Language Tcl
  • License
    MIT License
  • Created almost 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A stunning modern theme for ttk inspired by Fluent Design πŸ’ 

Azure theme for ttk

Screenshot of the Azure theme

How to use?

Just like for my Sun Valley theme in version 2.0 I wanted to make usage of the theme very simple, so the theme setting is handled by a separate tcl script. This way whether you want to use a dark or light theme, you need to import just a single file. The other thing that makes this a good solution is that normally switching between light and dark theme is not entirely perfect, and the colors are not correct.

# Just simply import the azure.tcl file
widget.tk.call("source", "azure.tcl")

# Then set the theme you want with the set_theme procedure
widget.tk.call("set_theme", "light")
# or
widget.tk.call("set_theme", "dark")

Changing themes

Normally changing between themes isn't that easy, because then the colors aren't correct. See this Stackoverflow question. However, with my current solution, you can change theme at any time, without any color issues.

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", "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()

New style elements

Azure theme has a style for every ttk widget, but there are some new widget styles, such as an accent button, toggle switch, toggle button, tickscale, and card. You can apply these with the style parameter.

If you need a highlighted button, use Accent.TButton:

accent_button = ttk.Button(root, text='Accent button', style='Accent.TButton', command=callback)

To create a toggle button you need a checkbutton, to which you can apply the Toggle.TButton style:

toggle_button = ttk.Checkbutton(root, text='Toggle button', style='Toggle.TButton', variable=var)

The use of switches instead of checkboxes is becoming more common these days, so this theme has a Switch.TCheckbutton style, that can be applied to checkbuttons:

switch = ttk.Checkbutton(root, text='Switch', style='Switch.TCheckbutton', variable=var)

If you don't like the big circle on the scale, you prefer something more solid, then use the Tick.TScale style:

tick_scale = ttk.Scale(root, style='Tick.TScale', variable=var)

If you only want a border around your widgets, not an entire LabelFrame then apply the Card.TFrame style to a Frame:

card = ttk.Frame(root, style='Card.TFrame', padding=(5, 6, 7, 8))

Bugs

  • Tk isn't really good at displaying png images, so if your program is laggy with the theme, please check out the gif-based branch!
  • If your app has a treeview widget, and you change the theme the window will expand horizontally. This is a quite strange bug that applies to all ttk themes.

If you scrolled down here, please check out my other themes!

More Repositories

1

Sun-Valley-ttk-theme

A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
Tcl
1,260
star
2

Forest-ttk-theme

A beautiful modern theme for ttk, inspired by MS Excel's look 🌲🌳
Tcl
165
star
3

Sun-Valley-ttk-examples

Example apps for my stunning Sun Valley ttk theme!
Python
131
star
4

tkinterDnD

A nice and easy-to-use wrapper around the tkdnd package
Tcl
25
star
5

chlorophyll

A Tkinter widget that fills your code with color
Python
19
star
6

tkcode

Use Chlorophyll instead
Python
18
star
7

Sun-Valley-messageboxes

Not a Tkinter project. I'll use this in @Tukaan. Some people requested to share the code, so here it is.
Tcl
15
star
8

Brainfuck-IDE

A Brainfuck editor written in Tkinter
Python
14
star
9

tkinter-docs

A Pythonic Tkinter documentation. I've abandoned this project a while ago, but I plan to continue
HTML
13
star
10

tkpdf

Pdf viewer widget for Tkinter
Python
7
star
11

Beautiful-tkinter-examples

Just experimenting, how to make Tkinter/Ttk look more beautiful
Tcl
7
star
12

flake8-tkinter

A flake8 plugin that helps you write better Tkinter code
Python
7
star
13

Sun-Valley-ttk-theme-svg

A stunning theme for ttk based on Microsoft's Sun Valley visual style. This time with SVG images.
Tcl
6
star
14

tkupgrade

Tool that rewrites Tkinter apps to use the Tukaan toolkit
Python
3
star
15

MovedtoGitLab

3
star
16

ttk-widget-factory

A useful widget appearance tester for ttk
Python
2
star
17

tktext

A text editor widget with spell checking and advanced text formatting options
Python
2
star
18

Pico-UI-kit

A library to easily work with electronic components using Raspberry Pi Pico
Python
2
star
19

rdbende.github.io

CSS
2
star
20

rdbende

Me
2
star
21

better-pygubu-designer

My customized Pygubu Designer with Sun Valley theme
Python
1
star
22

porcu-sv-ttk

Plugin to use the Sun Valley ttk theme in Porcupine
Python
1
star