我正在尝试用wxpython制作一个工具栏。我可以在我的主文件,但我使用了许多.py文件,使编程更清楚。你知道吗
在我的主文件中,我有以下代码:from microanalysis_menubar_view import TBar as toolbar_view
class Main(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, parent, id)
self.panel = wx.Panel(self, wx.ID_ANY)
self.SetTitle('Microanalysis')
# add menubar
self.menubar = menubar_view()
self.SetMenuBar(self.menubar)
#add toolbar
self.toolbar = toolbar_view()
在我的另一个文件(microanalysis\u menubar\u view)中,我有:class TBar(wx.ToolBar):
def __init__(self):
wx.ToolBar.__init__(self)
toolbar = self.CreateToolBar()
qtool = toolbar.AddLabelTool(wx.ID_ANY, 'Quit', wx.Bitmap('exit.png'))
toolbar.Realize()
我得到一个错误:
TypeError:找不到必需的参数“parent”(位置1)
我也有这样添加菜单栏的问题,但我解决了这个问题。这就更难了。你知道吗
我试着换衣服工具栏。实现()到我的主文件:self.toolbar.Realize(self.toolbar)
那也不行。
提前发送