
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Make your Tkinter application look better than ever with just two lines of code!
The theme is easily installable as a Python package
pip install sv-ttk
[!NOTE] The theme will only be applied to themable (
tkinter.ttk
) widgets, and not with the regular Tkinter widgets, they only benefit from the colorscheme.
For detailed documentation, visit the wiki page.
import tkinter
from tkinter import ttk
import sv_ttk
root = tkinter.Tk()
button = ttk.Button(root, text="Click me!")
button.pack()
# This is where the magic happens
sv_ttk.set_theme("dark")
root.mainloop()
Our intention is to keep the sv-ttk
package as simple as possible, while making it easy to integrate with other libraries.
You can use the darkdetect package to detect the system color scheme. Here's an example:
import darkdetect
sv_ttk.set_theme(darkdetect.theme())
It's only a matter of an extra import and passing the result of darkdetect.theme()
to sv_ttk.set_theme()
. It's that easy!
The Sun Valley theme doesn't change the title bar color on Windows when the theme is set to dark. You can use pywinstyles to achieve this. Here's an example:
import pywinstyles, sys
def apply_theme_to_titlebar(root):
version = sys.getwindowsversion()
if version.major == 10 and version.build >= 22000:
# Set the title bar color to the background color on Windows 11 for better appearance
pywinstyles.change_header_color(root, "#1c1c1c" if sv_ttk.get_theme() == "dark" else "#fafafa")
elif version.major == 10:
pywinstyles.apply_style(root, "dark" if sv_ttk.get_theme() == "dark" else "normal")
# A hacky way to update the title bar's color on Windows 10 (it doesn't update instantly like on Windows 11)
root.wm_attributes("-alpha", 0.99)
root.wm_attributes("-alpha", 1)
# Example usage (replace `root` with the reference to your main/Toplevel window)
apply_theme_to_titlebar(root)
Note that on Windows 10, due to its limitations, you can only set the title bar's color to black for dark mode and white for light mode. On Windows 11 the title bar can be set to any color.
[!WARNING] The
apply_theme_to_titlebar
works on Windows only, so you should check whether the platform is Windows before calling this function.
Here's how the windows look after calling set_title_bar_color()
:
Windows 10
Windows 11
Check out my other ttk themes!
FAQs
A gorgeous theme for Tkinter, based on Windows 11's UI
We found that sv-ttk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.