简体   繁体   English

Python-尝试获取我的声音文件以在应用程序启动时播放

[英]Python - Trying to Get My Sound File To Play On Startup of Application

I have used the following code and I am not sure why it is not working. 我使用了以下代码,但不确定为什么它不起作用。

from PythonCard import model

playSound = 1

class MainWindow(model.Background):
    pass

app = model.Application(MainWindow)
app.MainLoop()

if playSound == 1:
    s = Sound()
    s.read('start.wav')
    s.play
    playSound = 0

使用括号来调用函数:

s.play()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM