我已经为此工作了几个小时,并且尝试了从break
语句if
到创建索引变量的所有方法。我似乎找不到阻止声音/音乐播放的方法。我的目标是按“Q”并停止函数并while
循环以开始另一个while
循环。
import keyboard
import time
from playsound import playsound
#this handles the name that is displayed and makes it easier to input
def Song(type,opt):
time = 1
print(opt)
playsound(type)
print('''Enter Your Music Selection:
O) Overworld
F) Fighting
B) Boss-Strong Enemy
V) Victory
I) Inside-Taven-Shop
D) Dungion
L) Lose-Death
''')
while True:
while keyboard.is_pressed('O'):
Song('MusicStuff/test0.wav','Overworld Theme')
while keyboard.is_pressed('F'):
Song('MusicStuff/TrashLine.wav','Fighting Theme')