我正在使用wxPython包制作一个快速而肮脏的声音板,我想知道如何通过实现一个滚动的声音列表来播放。在
下面是一张我想要传达的图片: http://i.imgur.com/av0E5jC.png
到目前为止我的代码是:
import wx
class windowClass(wx.Frame):
def __init__(self, *args, **kwargs):
super(windowClass,self).__init__(*args,**kwargs)
self.basicGUI()
def basicGUI(self):
panel = wx.Panel(self)
menuBar = wx.MenuBar()
fileButton = wx.Menu()
editButton = wx.Menu()
exitItem = fileButton.append(wx.ID_EXIT, 'Exit','status msg...')
menuBar.Append(fileButton, 'File')
menuBar.Append(editButton, 'Edit')
self.SetMenuBar(menuBar)
self.Bind(wx.EVT_MENU, self.Quit, exitItem)
wx.TextCtrl(panel,pos=(10,10), size=(250,150))
self.SetTitle("Soundboard")
self.Show(True)
def Quit(self, e):
self.Close()
def main():
app = wx.App()
windowClass(None)
app.MainLoop()
main()
我的问题是,如何在面板上加载声音列表并单击某个按钮播放该声音。我不太关心实现暂停和快进功能,因为这只会播放非常快的声音文件。在
提前谢谢。在
只是删除了文本小部件,替换为一个列表框,并在item click上挂起一个回调函数,稍微详细说明一下:当单击时,它会找到项目的位置,检索标签名称并从字典中获取文件名 我们不需要显示完整的文件名,但不需要显示完整的文件名)
我重构了代码,使回调和其他属性是私有的,有助于实现。在
相关问题 更多 >
编程相关推荐