Skip to content

Type Hint Improvements#2635

Open
Atlamillias wants to merge 4 commits intohoffstadt:masterfrom
Atlamillias:typehint-improvements
Open

Type Hint Improvements#2635
Atlamillias wants to merge 4 commits intohoffstadt:masterfrom
Atlamillias:typehint-improvements

Conversation

@Atlamillias
Copy link
Copy Markdown
Contributor

@Atlamillias Atlamillias commented Apr 13, 2026

This PR corrects a few Python type annotations and argument defaults to reflect the hinted type within function signatures. The notable changes include:

  • context manager functions now return Iterator[int | str]
  • the label keyword argument is now Optional[str]
  • the event_type keyword argument for add_item_focus_handler() and add_item_hover_handler() now defaults to mvEventType_On instead of None

Concerning Areas:
Dear PyGui uses several deprecated symbols within the typing module. This PR adds Iterator and Optional to that list. Iterator can instead be imported from collections.abc. This is not possible with Optional, however, as the equivalent as of Python 3.10 is T | None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant