Coder Social home page Coder Social logo

limimo / forest-ttk-theme Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rdbende/forest-ttk-theme

0.0 0.0 0.0 1.51 MB

A beautiful modern theme for ttk, inspired by MS Excel's look ๐ŸŒฒ

License: MIT License

Python 19.33% Tcl 80.67%

forest-ttk-theme's Introduction

Forest theme for ttk

Partially based on my Azure theme

image image

How to use

Python / tkinter

To use the theme just import the forest-light.tcl, or the forest-dark.tcl file, and call the theme_use method to set the theme:

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

# Set the theme with the theme_use method
ttk.Style().theme_use('forest-light / forest-dark')

Tcl / tk

To use the theme just import the forest-light.tcl, or the forest-dark.tcl file, and call the theme use method to set the theme:

# Import the tcl file
source "forest-light.tcl / forest-dark.tcl"

# Set theme using the theme use method
ttk::style theme use forest-light / forest-dark

New style elements

The Forest theme similar to my Azure theme has some new widget styles, such as an accent button, toggle switch, toggle button and card. You can apply these with the style option.

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

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 ToggleButton style:

togglebutton = ttk.Checkbutton(root, text='Toggle button', 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)

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

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

A short example

for Python...

import tkinter as tk
from tkinter import ttk

root = tk.Tk()

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

# Set the theme with the theme_use method
ttk.Style().theme_use('forest-dark')

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

root.mainloop()

...and for Tcl

package require Tk 8.6

# Import the tcl file
source "forest-dark.tcl"

# Set theme using the theme use method
ttk::style theme use forest-dark

# A themed (ttk) button
ttk::button .button -text "I'm a themed button"
pack .button -pady 20

forest-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.