我在做一个项目,需要一组涂鸦2舞蹈开始播放一个wav文件,并停止在文件的结尾。你知道吗
(这不是完整的代码,而是我正在测试如何做,以便将其应用于更大的代码。)
from Myro import *
from winsound import*
from time import *
def playSong():
s=PlaySound('C:\Python34\cantHoldUs.wav',SND_FILENAME)
sleep(30)
s.PlaySound(None,SND_FILENAME)
while playSong()==True:
motors(-1,1)
歌曲播放并结束,但机器人不动。有人能告诉我怎么做吗?你知道吗
我建议您将代码重新构造为带有While循环的代码,因为这样更干净、更易于控制:
相关问题 更多 >
编程相关推荐