wxpython 按钮点击调用class类_wxpython通过调用其他类创建工具栏

我正在尝试用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)

那也不行。

提前发送

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值