etvr-ttk-theme 2.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) rdbende <rdbende@proton.me>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.4
2
+ Name: etvr-ttk-theme
3
+ Version: 2.7.0
4
+ Summary: A gorgeous theme for Tkinter, based on Windows 11's UI
5
+ Home-page: https://github.com/prohurtz/ETVR-ttk-theme
6
+ Author: rdbende
7
+ Author-email: rdbende@proton.me
8
+ License: MIT
9
+ Project-URL: Source, https://github.com/prohurtz/ETVR-ttk-theme
10
+ Project-URL: Documentation, https://github.com/rdbende/Sun-Valley-ttk-theme/wiki
11
+ Project-URL: Tracker, https://github.com/prohurtz/ETVR-ttk-theme/issues
12
+ Keywords: sv-ttk,tcl,tcl/tk,theme,tile,tk,ttk,tkinter,modern,fluent,dark-theme,sun-valley,windows-11,winui
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Software Development :: User Interfaces
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Tcl
22
+ Classifier: License :: OSI Approved :: MIT License
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: keywords
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: project-url
37
+ Dynamic: requires-python
38
+ Dynamic: summary
39
+
40
+ <div align="center">
41
+
42
+ # Sun Valley ttk theme
43
+ Make your Tkinter application look better than ever with just two lines of code!
44
+
45
+ ![Screenshot of Sun Valley ttk theme](assets/screenshot.png)
46
+
47
+ </div>
48
+
49
+
50
+ ## Installation [![PyPi downloads](https://static.pepy.tech/badge/sv-ttk)](https://pypi.org/project/sv-ttk)
51
+ The theme is easily installable as a Python package
52
+
53
+ ```
54
+ pip install sv-ttk
55
+ ```
56
+
57
+
58
+ ## Usage [![Documentation](https://img.shields.io/badge/-documentation-%23c368c4)](https://github.com/rdbende/Sun-Valley-ttk-theme/wiki/Usage-with-Python)
59
+ > [!NOTE]
60
+ > The theme will only be applied to themable (`tkinter.ttk`) widgets, and not with the regular Tkinter widgets, they only benefit from the colorscheme.
61
+
62
+ For detailed documentation, visit the [wiki page](https://github.com/rdbende/Sun-Valley-ttk-theme/wiki/Usage-with-Python).
63
+
64
+ ```python
65
+ import tkinter
66
+ from tkinter import ttk
67
+
68
+ import sv_ttk
69
+
70
+ root = tkinter.Tk()
71
+
72
+ button = ttk.Button(root, text="Click me!")
73
+ button.pack()
74
+
75
+ # This is where the magic happens
76
+ sv_ttk.set_theme("dark")
77
+
78
+ root.mainloop()
79
+ ```
80
+
81
+
82
+ ## Tips and tricks
83
+ Our intention is to keep the `sv-ttk` package as simple as possible, while making it easy to integrate with other libraries.
84
+
85
+ ### Set the theme to the system theme
86
+ You can use the [darkdetect](https://github.com/albertosottile/darkdetect) package to detect the system color scheme. Here's an example:
87
+
88
+ ```python
89
+ import darkdetect
90
+
91
+ sv_ttk.set_theme(darkdetect.theme())
92
+ ```
93
+
94
+ 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!
95
+
96
+
97
+ ### Dark mode title bar on Windows
98
+ The Sun Valley theme doesn't change the title bar color on Windows when the theme is set to dark. You can use [pywinstyles](https://github.com/Akascape/py-window-styles) to achieve this. Here's an example:
99
+
100
+ ```python
101
+ import pywinstyles, sys
102
+
103
+ def apply_theme_to_titlebar(root):
104
+ version = sys.getwindowsversion()
105
+
106
+ if version.major == 10 and version.build >= 22000:
107
+ # Set the title bar color to the background color on Windows 11 for better appearance
108
+ pywinstyles.change_header_color(root, "#1c1c1c" if sv_ttk.get_theme() == "dark" else "#fafafa")
109
+ elif version.major == 10:
110
+ pywinstyles.apply_style(root, "dark" if sv_ttk.get_theme() == "dark" else "normal")
111
+
112
+ # A hacky way to update the title bar's color on Windows 10 (it doesn't update instantly like on Windows 11)
113
+ root.wm_attributes("-alpha", 0.99)
114
+ root.wm_attributes("-alpha", 1)
115
+
116
+ # Example usage (replace `root` with the reference to your main/Toplevel window)
117
+ apply_theme_to_titlebar(root)
118
+ ```
119
+
120
+ 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.
121
+
122
+
123
+ > [!WARNING]
124
+ > The `apply_theme_to_titlebar` works on Windows only, so you should check whether the platform is Windows before calling this function.
125
+
126
+
127
+ Here's how the windows look after calling `set_title_bar_color()`:
128
+
129
+ <details>
130
+ <summary>Screenshots</summary>
131
+ <p align="center">
132
+ <b>Windows 10</b>
133
+ <br>
134
+ <img src="assets/win10.png"/>
135
+ <br><br>
136
+ <b>Windows 11</b>
137
+ <br>
138
+ <img src="assets/win11.png"/>
139
+ </p>
140
+ </details>
141
+
142
+
143
+ ## Wanna see more?
144
+ Check out my other ttk themes!
145
+ - The [Azure ttk theme](https://github.com/rdbende/Azure-ttk-theme)
146
+ - The [Forest ttk theme](https://github.com/rdbende/Forest-ttk-theme)
@@ -0,0 +1,107 @@
1
+ <div align="center">
2
+
3
+ # Sun Valley ttk theme
4
+ Make your Tkinter application look better than ever with just two lines of code!
5
+
6
+ ![Screenshot of Sun Valley ttk theme](assets/screenshot.png)
7
+
8
+ </div>
9
+
10
+
11
+ ## Installation [![PyPi downloads](https://static.pepy.tech/badge/sv-ttk)](https://pypi.org/project/sv-ttk)
12
+ The theme is easily installable as a Python package
13
+
14
+ ```
15
+ pip install sv-ttk
16
+ ```
17
+
18
+
19
+ ## Usage [![Documentation](https://img.shields.io/badge/-documentation-%23c368c4)](https://github.com/rdbende/Sun-Valley-ttk-theme/wiki/Usage-with-Python)
20
+ > [!NOTE]
21
+ > The theme will only be applied to themable (`tkinter.ttk`) widgets, and not with the regular Tkinter widgets, they only benefit from the colorscheme.
22
+
23
+ For detailed documentation, visit the [wiki page](https://github.com/rdbende/Sun-Valley-ttk-theme/wiki/Usage-with-Python).
24
+
25
+ ```python
26
+ import tkinter
27
+ from tkinter import ttk
28
+
29
+ import sv_ttk
30
+
31
+ root = tkinter.Tk()
32
+
33
+ button = ttk.Button(root, text="Click me!")
34
+ button.pack()
35
+
36
+ # This is where the magic happens
37
+ sv_ttk.set_theme("dark")
38
+
39
+ root.mainloop()
40
+ ```
41
+
42
+
43
+ ## Tips and tricks
44
+ Our intention is to keep the `sv-ttk` package as simple as possible, while making it easy to integrate with other libraries.
45
+
46
+ ### Set the theme to the system theme
47
+ You can use the [darkdetect](https://github.com/albertosottile/darkdetect) package to detect the system color scheme. Here's an example:
48
+
49
+ ```python
50
+ import darkdetect
51
+
52
+ sv_ttk.set_theme(darkdetect.theme())
53
+ ```
54
+
55
+ 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!
56
+
57
+
58
+ ### Dark mode title bar on Windows
59
+ The Sun Valley theme doesn't change the title bar color on Windows when the theme is set to dark. You can use [pywinstyles](https://github.com/Akascape/py-window-styles) to achieve this. Here's an example:
60
+
61
+ ```python
62
+ import pywinstyles, sys
63
+
64
+ def apply_theme_to_titlebar(root):
65
+ version = sys.getwindowsversion()
66
+
67
+ if version.major == 10 and version.build >= 22000:
68
+ # Set the title bar color to the background color on Windows 11 for better appearance
69
+ pywinstyles.change_header_color(root, "#1c1c1c" if sv_ttk.get_theme() == "dark" else "#fafafa")
70
+ elif version.major == 10:
71
+ pywinstyles.apply_style(root, "dark" if sv_ttk.get_theme() == "dark" else "normal")
72
+
73
+ # A hacky way to update the title bar's color on Windows 10 (it doesn't update instantly like on Windows 11)
74
+ root.wm_attributes("-alpha", 0.99)
75
+ root.wm_attributes("-alpha", 1)
76
+
77
+ # Example usage (replace `root` with the reference to your main/Toplevel window)
78
+ apply_theme_to_titlebar(root)
79
+ ```
80
+
81
+ 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.
82
+
83
+
84
+ > [!WARNING]
85
+ > The `apply_theme_to_titlebar` works on Windows only, so you should check whether the platform is Windows before calling this function.
86
+
87
+
88
+ Here's how the windows look after calling `set_title_bar_color()`:
89
+
90
+ <details>
91
+ <summary>Screenshots</summary>
92
+ <p align="center">
93
+ <b>Windows 10</b>
94
+ <br>
95
+ <img src="assets/win10.png"/>
96
+ <br><br>
97
+ <b>Windows 11</b>
98
+ <br>
99
+ <img src="assets/win11.png"/>
100
+ </p>
101
+ </details>
102
+
103
+
104
+ ## Wanna see more?
105
+ Check out my other ttk themes!
106
+ - The [Azure ttk theme](https://github.com/rdbende/Azure-ttk-theme)
107
+ - The [Forest ttk theme](https://github.com/rdbende/Forest-ttk-theme)
@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.4
2
+ Name: etvr-ttk-theme
3
+ Version: 2.7.0
4
+ Summary: A gorgeous theme for Tkinter, based on Windows 11's UI
5
+ Home-page: https://github.com/prohurtz/ETVR-ttk-theme
6
+ Author: rdbende
7
+ Author-email: rdbende@proton.me
8
+ License: MIT
9
+ Project-URL: Source, https://github.com/prohurtz/ETVR-ttk-theme
10
+ Project-URL: Documentation, https://github.com/rdbende/Sun-Valley-ttk-theme/wiki
11
+ Project-URL: Tracker, https://github.com/prohurtz/ETVR-ttk-theme/issues
12
+ Keywords: sv-ttk,tcl,tcl/tk,theme,tile,tk,ttk,tkinter,modern,fluent,dark-theme,sun-valley,windows-11,winui
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Software Development :: User Interfaces
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Tcl
22
+ Classifier: License :: OSI Approved :: MIT License
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: keywords
34
+ Dynamic: license
35
+ Dynamic: license-file
36
+ Dynamic: project-url
37
+ Dynamic: requires-python
38
+ Dynamic: summary
39
+
40
+ <div align="center">
41
+
42
+ # Sun Valley ttk theme
43
+ Make your Tkinter application look better than ever with just two lines of code!
44
+
45
+ ![Screenshot of Sun Valley ttk theme](assets/screenshot.png)
46
+
47
+ </div>
48
+
49
+
50
+ ## Installation [![PyPi downloads](https://static.pepy.tech/badge/sv-ttk)](https://pypi.org/project/sv-ttk)
51
+ The theme is easily installable as a Python package
52
+
53
+ ```
54
+ pip install sv-ttk
55
+ ```
56
+
57
+
58
+ ## Usage [![Documentation](https://img.shields.io/badge/-documentation-%23c368c4)](https://github.com/rdbende/Sun-Valley-ttk-theme/wiki/Usage-with-Python)
59
+ > [!NOTE]
60
+ > The theme will only be applied to themable (`tkinter.ttk`) widgets, and not with the regular Tkinter widgets, they only benefit from the colorscheme.
61
+
62
+ For detailed documentation, visit the [wiki page](https://github.com/rdbende/Sun-Valley-ttk-theme/wiki/Usage-with-Python).
63
+
64
+ ```python
65
+ import tkinter
66
+ from tkinter import ttk
67
+
68
+ import sv_ttk
69
+
70
+ root = tkinter.Tk()
71
+
72
+ button = ttk.Button(root, text="Click me!")
73
+ button.pack()
74
+
75
+ # This is where the magic happens
76
+ sv_ttk.set_theme("dark")
77
+
78
+ root.mainloop()
79
+ ```
80
+
81
+
82
+ ## Tips and tricks
83
+ Our intention is to keep the `sv-ttk` package as simple as possible, while making it easy to integrate with other libraries.
84
+
85
+ ### Set the theme to the system theme
86
+ You can use the [darkdetect](https://github.com/albertosottile/darkdetect) package to detect the system color scheme. Here's an example:
87
+
88
+ ```python
89
+ import darkdetect
90
+
91
+ sv_ttk.set_theme(darkdetect.theme())
92
+ ```
93
+
94
+ 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!
95
+
96
+
97
+ ### Dark mode title bar on Windows
98
+ The Sun Valley theme doesn't change the title bar color on Windows when the theme is set to dark. You can use [pywinstyles](https://github.com/Akascape/py-window-styles) to achieve this. Here's an example:
99
+
100
+ ```python
101
+ import pywinstyles, sys
102
+
103
+ def apply_theme_to_titlebar(root):
104
+ version = sys.getwindowsversion()
105
+
106
+ if version.major == 10 and version.build >= 22000:
107
+ # Set the title bar color to the background color on Windows 11 for better appearance
108
+ pywinstyles.change_header_color(root, "#1c1c1c" if sv_ttk.get_theme() == "dark" else "#fafafa")
109
+ elif version.major == 10:
110
+ pywinstyles.apply_style(root, "dark" if sv_ttk.get_theme() == "dark" else "normal")
111
+
112
+ # A hacky way to update the title bar's color on Windows 10 (it doesn't update instantly like on Windows 11)
113
+ root.wm_attributes("-alpha", 0.99)
114
+ root.wm_attributes("-alpha", 1)
115
+
116
+ # Example usage (replace `root` with the reference to your main/Toplevel window)
117
+ apply_theme_to_titlebar(root)
118
+ ```
119
+
120
+ 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.
121
+
122
+
123
+ > [!WARNING]
124
+ > The `apply_theme_to_titlebar` works on Windows only, so you should check whether the platform is Windows before calling this function.
125
+
126
+
127
+ Here's how the windows look after calling `set_title_bar_color()`:
128
+
129
+ <details>
130
+ <summary>Screenshots</summary>
131
+ <p align="center">
132
+ <b>Windows 10</b>
133
+ <br>
134
+ <img src="assets/win10.png"/>
135
+ <br><br>
136
+ <b>Windows 11</b>
137
+ <br>
138
+ <img src="assets/win11.png"/>
139
+ </p>
140
+ </details>
141
+
142
+
143
+ ## Wanna see more?
144
+ Check out my other ttk themes!
145
+ - The [Azure ttk theme](https://github.com/rdbende/Azure-ttk-theme)
146
+ - The [Forest ttk theme](https://github.com/rdbende/Forest-ttk-theme)
@@ -0,0 +1,18 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ etvr_ttk_theme.egg-info/PKG-INFO
6
+ etvr_ttk_theme.egg-info/SOURCES.txt
7
+ etvr_ttk_theme.egg-info/dependency_links.txt
8
+ etvr_ttk_theme.egg-info/top_level.txt
9
+ sv_ttk/__init__.py
10
+ sv_ttk/py.typed
11
+ sv_ttk/sv.tcl
12
+ sv_ttk/theme/dark.tcl
13
+ sv_ttk/theme/light.tcl
14
+ sv_ttk/theme/sprites_dark.tcl
15
+ sv_ttk/theme/sprites_light.tcl
16
+ sv_ttk/theme/spritesheet_dark.png
17
+ sv_ttk/theme/spritesheet_light.png
18
+ tests/test_sv_ttk.py
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,60 @@
1
+ import re
2
+ from pathlib import Path
3
+
4
+ from setuptools import setup
5
+
6
+ long_description = re.sub(
7
+ r"(?s)<picture>.*</picture>",
8
+ '<img alt="Cover image" src="https://raw.githubusercontent.com/rdbende/Sun-Valley-ttk-theme/master/assets/hero_light.png">',
9
+ (Path(__file__).parent / "README.md").read_text(),
10
+ )
11
+
12
+
13
+ setup(
14
+ name="etvr-ttk-theme",
15
+ version="2.7.0",
16
+ license="MIT",
17
+ author="rdbende",
18
+ author_email="rdbende@proton.me",
19
+ url="https://github.com/prohurtz/ETVR-ttk-theme",
20
+ project_urls={
21
+ "Source": "https://github.com/prohurtz/ETVR-ttk-theme",
22
+ "Documentation": "https://github.com/rdbende/Sun-Valley-ttk-theme/wiki",
23
+ "Tracker": "https://github.com/prohurtz/ETVR-ttk-theme/issues",
24
+ },
25
+ description="A gorgeous theme for Tkinter, based on Windows 11's UI",
26
+ long_description=long_description,
27
+ long_description_content_type="text/markdown",
28
+ packages=["sv_ttk"],
29
+ package_data={"sv_ttk": ["sv.tcl", "theme/*", "py.typed"]},
30
+ python_requires=">=3.9",
31
+ classifiers=[
32
+ "Intended Audience :: Developers",
33
+ "Topic :: Software Development :: User Interfaces",
34
+ "Programming Language :: Python :: 3 :: Only",
35
+ "Programming Language :: Python :: 3.9",
36
+ "Programming Language :: Python :: 3.10",
37
+ "Programming Language :: Python :: 3.11",
38
+ "Programming Language :: Python :: 3.12",
39
+ "Programming Language :: Python :: 3.13",
40
+ "Programming Language :: Tcl",
41
+ "License :: OSI Approved :: MIT License",
42
+ "Operating System :: OS Independent",
43
+ ],
44
+ keywords=[
45
+ "sv-ttk",
46
+ "tcl",
47
+ "tcl/tk",
48
+ "theme",
49
+ "tile",
50
+ "tk",
51
+ "ttk",
52
+ "tkinter",
53
+ "modern",
54
+ "fluent",
55
+ "dark-theme",
56
+ "sun-valley",
57
+ "windows-11",
58
+ "winui",
59
+ ],
60
+ )
@@ -0,0 +1,48 @@
1
+ from __future__ import annotations
2
+
3
+ import tkinter
4
+ from functools import partial
5
+ from pathlib import Path
6
+ from tkinter import ttk
7
+
8
+ TCL_THEME_FILE_PATH = Path(__file__).with_name("sv.tcl").absolute()
9
+
10
+
11
+ def _load_theme(style: ttk.Style) -> None:
12
+ if not isinstance(style.master, tkinter.Tk):
13
+ raise TypeError("root must be a `tkinter.Tk` instance!")
14
+
15
+ if not hasattr(style.master, "_sv_ttk_loaded"):
16
+ style.tk.call("source", str(TCL_THEME_FILE_PATH))
17
+ style.master._sv_ttk_loaded = True # type: ignore
18
+
19
+
20
+ def get_theme(root: tkinter.Tk | None = None) -> str:
21
+ style = ttk.Style(master=root)
22
+ _load_theme(style)
23
+
24
+ theme = style.theme_use()
25
+ return {"sun-valley-dark": "dark", "sun-valley-light": "light"}.get(theme, theme)
26
+
27
+
28
+ def set_theme(theme: str, root: tkinter.Tk | None = None) -> None:
29
+ style = ttk.Style(master=root)
30
+ _load_theme(style)
31
+
32
+ theme = theme.lower()
33
+
34
+ if theme not in {"dark", "light"}:
35
+ raise RuntimeError(f"not a valid sv_ttk theme: {theme}")
36
+
37
+ style.theme_use(f"sun-valley-{theme}")
38
+
39
+
40
+ def toggle_theme(root: tkinter.Tk | None = None) -> None:
41
+ style = ttk.Style(master=root)
42
+ _load_theme(style)
43
+
44
+ set_theme("light" if style.theme_use() == "sun-valley-dark" else "dark")
45
+
46
+
47
+ use_dark_theme = partial(set_theme, "dark")
48
+ use_light_theme = partial(set_theme, "light")
File without changes