This library helps you to set style to tkinter default widget using stylesheet with ease.
Project description
Tkinter stylesheet - Tkss
This library helps you to set style to tkinter default widget using stylesheet without much work.
Quick Example:
from tkinter import *
from tkstylesheet import TkThemeLoader
_style = """
Tk{
background: "#565657"; /*background color of the root widget*/
}
Label{
foreground: "#ebebeb";
background: "#565657";
}
Button{
foreground: "#ebebeb";
background: "#565657";
}
"""
root = Tk()
Label(root, text="label").pack()
Button(root, text="Button").pack()
theme = TkThemeLoader(root)
theme.setStylesheet(_style) # pass as string
root.mainloop()
If you want to load tkss from a file:
- save you theme in a file
- load it using TkThemeLoader().loadStyleSheet(file_path)
example:
theme.tkss
Tk{
background: "#565657";
}
Label{
foreground: "#ebebeb";
background: "#565657";
}
Button{
foreground: "#ebebeb";
background: "#565657";
}
project.py
from tkinter import *
from tkstylesheet import TkThemeLoader
root = Tk()
Label(root, text="label").pack()
Button(root, text="Button").pack()
theme = TkThemeLoader(root)
theme.loadStyleSheet("theme.tkss") # pass file path
root.mainloop()
Please read further examples on how to switch theme etc, here. Refer stylesheets examples here
Documentation here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tkstylesheet-0.0.1b0.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file tkstylesheet-0.0.1b0.tar.gz
.
File metadata
- Download URL: tkstylesheet-0.0.1b0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60db81c9d7ca133c33d2ab4f14b26e51ee375e8d73cb4b48d5837b63d8323e88 |
|
MD5 | 54a51b5263941d26f909449d8c3f737a |
|
BLAKE2b-256 | 3b08025ba05f4d5ae1b15ec901593d8c7b5ba11eb2921307378a34227816aa84 |
File details
Details for the file tkstylesheet-0.0.1b0-py3-none-any.whl
.
File metadata
- Download URL: tkstylesheet-0.0.1b0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31fcc7337754aa1d3f15835c44e99be021d9f08fbe4fed665bec51a3fc1dec95 |
|
MD5 | ba1682fb7655eb88c76c9f0b714f60c5 |
|
BLAKE2b-256 | 71ffcbd82a6ba768e3442a75c8aadb113ec4be1455ea3260c93856937a752381 |