Skip to content

Complete ttkthemes #13858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
"stubs/shapely",
"stubs/tensorflow",
"stubs/tqdm",
"stubs/ttkthemes",
"stubs/vobject",
"stubs/workalendar",
"stubs/wurlitzer",
Expand Down
1 change: 1 addition & 0 deletions stdlib/tkinter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ class Tk(Misc, Wm):
sync: bool = False,
use: str | None = None,
) -> None: ...
# Keep this in sync with ttktheme.ThemedTk. See issue #13858
@overload
def configure(
self,
Expand Down
1 change: 1 addition & 0 deletions stubs/ttkthemes/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
version = "3.2.*"
upstream_repository = "https://github.com./RedFantom/ttkthemes"
requires = ["Pillow"]
6 changes: 4 additions & 2 deletions stubs/ttkthemes/ttkthemes/_imgops.pyi
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
def shift_hue(image, hue): ...
def make_transparent(image): ...
from PIL.Image import Image

def shift_hue(image: Image, hue: float) -> Image: ...
def make_transparent(image: Image) -> Image: ...
13 changes: 7 additions & 6 deletions stubs/ttkthemes/ttkthemes/_utils.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from _typeshed import Incomplete
from _typeshed import FileDescriptorOrPath, StrOrBytesPath
from contextlib import AbstractContextManager

def temporary_chdir(new_dir) -> None: ...
def get_file_directory(): ...
def get_temp_directory(): ...
def get_themes_directory(theme_name: Incomplete | None = None, png: bool = False): ...
def create_directory(directory): ...
def temporary_chdir(new_dir: FileDescriptorOrPath) -> AbstractContextManager[None]: ...
def get_file_directory() -> str: ...
def get_temp_directory() -> str: ...
def get_themes_directory(theme_name: str | None = None, png: bool = False) -> str: ...
def create_directory(directory: StrOrBytesPath) -> StrOrBytesPath: ...
2 changes: 1 addition & 1 deletion stubs/ttkthemes/ttkthemes/_widget.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ThemedWidget:
PACKAGES: ClassVar[dict[str, str]]
tk: _tkinter.TkappType
png_support: bool
def __init__(self, tk_interpreter, gif_override: bool = False) -> None: ...
def __init__(self, tk_interpreter: _tkinter.TkappType, gif_override: bool = False) -> None: ...
def set_theme(self, theme_name: str) -> None: ...
def get_themes(self) -> list[str]: ...
@property
Expand Down
2 changes: 1 addition & 1 deletion stubs/ttkthemes/ttkthemes/themed_style.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from ._widget import ThemedWidget

class ThemedStyle(ttk.Style, ThemedWidget):
def __init__(
self, master: tkinter.Misc | None = ..., *, theme: str | None = ..., gif_override: bool | None = ..., **kwargs
self, master: tkinter.Misc | None = ..., *, theme: str | None = None, gif_override: bool | None = False
) -> None: ...
# theme_use() can't return None (differs from ttk.Style)
def theme_use(self, theme_name: str | None = None) -> str: ... # type: ignore[override]
Expand Down
62 changes: 54 additions & 8 deletions stubs/ttkthemes/ttkthemes/themed_tk.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tkinter
from _typeshed import Incomplete
from typing import Any

from ._widget import ThemedWidget

Expand All @@ -21,10 +21,56 @@ class ThemedTk(tkinter.Tk, ThemedWidget):
background: bool | None = ..., # old alias for themebg
gif_override: bool = ...,
) -> None: ...
def set_theme(self, theme_name, toplevel: bool | None = None, themebg: bool | None = None) -> None: ...
# TODO: currently no good way to say "use the same big list of kwargs as parent class but also add these"
def config(self, kw: Incomplete | None = None, **kwargs): ... # type: ignore[override]
def cget(self, k): ...
def configure(self, kw: Incomplete | None = None, **kwargs): ... # type: ignore[override]
def __getitem__(self, k): ...
def __setitem__(self, k, v) -> None: ...
def set_theme(self, theme_name: str, toplevel: bool | None = None, themebg: bool | None = None) -> None: ...
# Keep this in sync with tkinter.Tk
def config( # type: ignore[override]
self,
kw: dict[str, Any] | None = None,
*,
themebg: bool | None = ...,
toplevel: bool | None = ...,
theme: str | None = ...,
background: str = ...,
bd: tkinter._ScreenUnits = ...,
bg: str = ...,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
cursor: tkinter._Cursor = ...,
height: tkinter._ScreenUnits = ...,
highlightbackground: str = ...,
highlightcolor: str = ...,
highlightthickness: tkinter._ScreenUnits = ...,
menu: tkinter.Menu = ...,
padx: tkinter._ScreenUnits = ...,
pady: tkinter._ScreenUnits = ...,
relief: tkinter._Relief = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: tkinter._ScreenUnits = ...,
) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
def cget(self, k: str) -> Any: ...
def configure( # type: ignore[override]
self,
kw: dict[str, Any] | None = None,
*,
themebg: bool | None = ...,
toplevel: bool | None = ...,
theme: str | None = ...,
background: str = ...,
bd: tkinter._ScreenUnits = ...,
bg: str = ...,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
cursor: tkinter._Cursor = ...,
height: tkinter._ScreenUnits = ...,
highlightbackground: str = ...,
highlightcolor: str = ...,
highlightthickness: tkinter._ScreenUnits = ...,
menu: tkinter.Menu = ...,
padx: tkinter._ScreenUnits = ...,
pady: tkinter._ScreenUnits = ...,
relief: tkinter._Relief = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: tkinter._ScreenUnits = ...,
) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
def __getitem__(self, k: str) -> Any: ...
def __setitem__(self, k: str, v: Any) -> None: ...