[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: pygame.mixer.music.play problem



I'm having some problems with pygame.mixer.music.play().

According to the docs this is the syntax:
pygame.mixer.music.play(loops=0, startpos=0.0)

But I get a "TypeError: play() takes no keyword arguments" when I trying "pygame.mixer.music.play(0, startpos = 10.0)" .
yeah, none of the pygame functions accept keyword arguments like this. well the only one that does is the Event initializer. this is mainly just documentation, telling what the argument is and what the default value is if not passed.


Another (more serious) buglet is the Segmentation Fault I get when trying "pygame.mixer.music.play(0, 0)". "pygame.mixer.music.play(0, 0.00001)" works fine...
curious. i'll doublecheck the code. passing 0 should be the same as passing no argument. it shouldn't be crashing when passing no argument for the 'startpos'. what sort of music format are you playing with this?


A suggestion: it would be cool to have a .stop_at(end_pos) method.
this would be a little trickier. for the most part you'll have to just do it yourself. you can poll the music play position and stop it after it has reached a certain point. but if you are running a complex game that will not be exact.