Giter Club home page Giter Club logo

azure-ttk-theme's Introduction

Azure theme for ttk

image image

Usage (tkinter)

To use the theme just create a style, import the azure.tcl, or the azure-dark.tcl file, and call the theme_use method to set the theme:

# Create a style
style = ttk.Style(root)

# Import the tcl file
root.tk.call('source', 'azure.tcl / azure-dark.tcl')

# Set the theme with the theme_use method
style.theme_use('azure / azure-dark')

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, and toggle button. You can apply these with the style option

If you need a highlighted button, use AccentButton:

button = ttk.Button(root, text='AccentButton', style='AccentButton', command=callback)

To create a ToggleButton you need a checkbutton, to which you can apply the ToggleButton style:

togglebutton = ttk.Checkbutton(root, text='ToggleButton', style='ToggleButton', variable=var)

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

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

A short example

import tkinter as tk
from tkinter import ttk

root = tk.Tk()

# Create a style
style = ttk.Style(root)

# Import the tcl file
root.tk.call('source', 'azure.tcl')

# Set the theme with the theme_use method
style.theme_use('azure')

# A themed button
button = ttk.Button(root, text='I\'m a themed button')
button.pack(pady=20)

root.mainloop()

Warnings:

  • If you don't use Windows, the default font for tkinter (TkDefaultFont) can be a bit ugly in the theme, so I recommend to you use tkextrafont, which is great if you want to use an .ttf file without installing (I use Arial for it and recommend this to everyone)
  • Performance issue:
    If you put a widget inside a LabelFrame, the hover rendering can be extra slow (the same goes for Notebook)

Design - inspired by Microsoft's Fluent design

  • Flat, rounded elements, high contrast
  • Colors: blue #007fff #3398ff, gray #e6e6e6 #cccccc #999999 #737373 #333333 and of course #ffffff #000000 #ff0000

azure-ttk-theme's People

Contributors

rdbende avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.