Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
sound.Player in scene
-
Is it possible to get a sound.Player to play in a scene? I have tried the following code in the setup method:
music_player = sound.Player(file_path) music_player.play()
But it does not work.
sound.play_effect(file_path)
does work though, and both of these work when not presented in a scene. Is there a way to make it work? -
The problem is probably that
music_player
is a local variable, and falls out of scope (gets garbage-collected) when thesetup
method returns. Tryself.music_player = ...
instead to make it an attribute of the scene. -
Ah yes, forgot about that. Works fine now.