#1
|
|||
|
|||
Basic soundtrack
I'm trying to learn the basics of scripting in Vizard/Python and I'm having some confusion. The code below is intended to just start, stop, or change the background music, but it's getting errors that I suppose must stem from me not understanding variable declarations. If someone could give me a push in the right direction I'd really appreciate it.
music = viz.add('song1.mp3') music.loop(viz.ON) def ChangeToFirst(): music.rewind() music = viz.add('song1.mp3') music.play() def ChangeToSecond(): music.rewind() music = viz.add('song2.mp3') music.play() def StopTheMusic(): music.rewind() def mykey(key): if key == '1': ChangeToFirst() elif key == '2': ChangeToSecond() elif key == ' ': StopTheMusic() |
|
|