首页 > 编程知识 正文

python游戏中加入背景音乐,python爬取音乐代码

时间:2023-05-05 13:59:14 阅读:118437 作者:1379

我在玩游戏。 你在避开航天飞机迎面而来的流星。 这是我的第一个Python程序。 我真的很难理解音乐的部分。 这个想法是只使用Python。 在

现在,我不知道我要怎么让音乐播放,迷人的白天点击按钮,但控制不了宇宙飞船。 在

我不完全知道发生了什么。 我找了好几天,但没有答案。 在classboard(wx.Panel ) :上

板宽度=5

BoardHeight=12

Speed=50

ID_TIMER=1

def __init__(self,parent ) :

wx.Panel.__init__(self,parent )

self.timer=wx.timer(self,Board.ID_TIMER ) )。

self.bind(wx.evt_paint,self.OnPaint ) )。

self.bind(wx.evt_key_down,self.OnKeyDown )。

self.bind(wx.evt_timer,self.OnTimer,id=Board.ID_TIMER ) )。

self.ClearBoard (

自. music=wx.panel (自)

button=wx.button (自,标签=' play ' ) )。

self.music=wx.media.media ctrl (self.music,-1,' game.mp3 ' ) )。

Button.bind(wx.evt_Button,self.play ) ) ) ) ) ) )。

def play (自,事件) :

self.music.Play (

对我来说,我认为它应该如何工作,但没有:

^{pr2}$

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。