Pre-release
This release is a pre-release and may not be stable for production use.
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
Metadata
Release files for tkstylesheet 0.0.1b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tkstylesheet-0.0.1b0.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tkstylesheet-0.0.1b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / tkstylesheet-0.0.1b0.tar.gz
| Download URL | tkstylesheet-0.0.1b0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60db81c9d7ca133c33d2ab4f14b26e51ee375e8d73cb4b48d5837b63d8323e88
|
|
BLAKE2b-256 checksum How to use checksums |
3b08025ba05f4d5ae1b15ec901593d8c7b5ba11eb2921307378a34227816aa84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / tkstylesheet-0.0.1b0-py3-none-any.whl
| Download URL | tkstylesheet-0.0.1b0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31fcc7337754aa1d3f15835c44e99be021d9f08fbe4fed665bec51a3fc1dec95
|
|
BLAKE2b-256 checksum How to use checksums |
71ffcbd82a6ba768e3442a75c8aadb113ec4be1455ea3260c93856937a752381
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|