Skip to content
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

pygame.Music #3110

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 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: 1 addition & 0 deletions buildconfig/stubs/gen_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"event": ["Event"],
"font": ["Font"],
"mixer": ["Sound", "Channel"],
"mixer_music": ["Music"],
"time": ["Clock"],
"joystick": ["Joystick"],
"window": ["Window"],
Expand Down
1 change: 1 addition & 0 deletions buildconfig/stubs/pygame/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ from ._debug import print_debug_info as print_debug_info
from .event import Event as Event
from .font import Font as Font
from .mixer import Sound as Sound, Channel as Channel
from .mixer_music import Music as Music
from .time import Clock as Clock
from .joystick import Joystick as Joystick
from .window import Window as Window
Expand Down
31 changes: 31 additions & 0 deletions buildconfig/stubs/pygame/mixer_music.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,34 @@ def queue(filename: FileLike, namehint: str = "", loops: int = 0) -> None: ...
def set_endevent(event_type: int, /) -> None: ...
def get_endevent() -> int: ...
def get_metadata(filename: Optional[FileLike] = None, namehint: str = "") -> Dict[str, str]: ...

class Music:
def __init__(self, filename: FileLike, namehint: Optional[str] = "") -> None: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namehint cannot be type None: it should be just str, not Optional[str].
In fact, the type annotation for pygame.mixer.music.load should be fixed in this way too because it also cannot take None.


def play(self, loops: int = 0, startpos: float = 0.0, fade_in: float = 0.0) -> None: ...
def stop(self) -> None: ...
def rewind(self) -> None: ...

@property
def title(self) -> str: ...
@property
def artist(self) -> str: ...
@property
def album(self) -> str: ...
@property
def copyright(self) -> str: ...

@property
def position(self) -> float: ...
@position.setter
def position(self, value : float) -> None: ...
@property
def duration(self) -> float: ...
@property
def paused(self) -> bool: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing paused setter in stub.

@property
def volume(self) -> float: ...
@volume.setter
def volume(self, value : float) -> None: ...
@property
def ended(self) -> bool: ...
Loading
Loading