WxPython - 对话框,模块对象不可调用
文件 Dialog1.py 中有一个自定义对话框类
class Dialog1(wx.Dialog):
def __init__(self, prnt):
wx.Dialog.__init__(self, id=wxID_DIALOG1, name='Dialog1', parent=prnt,
pos=wx.Point(110, 140), size=wx.Size(400, 498),
style=wx.DEFAULT_DIALOG_STYLE, title='Dialog1')
我在其他文件 Frame - wx.Frame
self.button1.Bind(wx.EVT_BUTTON, self.Dec, id=wxID_FRAME3BUTTON1)
,带有按钮和显示对话框的方法
def Dec(self, event):
import Dialog1
self.dialog = Dialog1(self)
self.dialog.ShowModal()
#dialog.Destroy()
return True
,当我按下此按钮时,我有一个错误;
TypeError: 'module' is not Callable
为什么?请帮我
编辑:好的,现在可以了,复制粘贴方法太多了……抱歉
REMOVE THIS QUESTION
i have a custom Dialog class in file Dialog1.py
class Dialog1(wx.Dialog):
def __init__(self, prnt):
wx.Dialog.__init__(self, id=wxID_DIALOG1, name='Dialog1', parent=prnt,
pos=wx.Point(110, 140), size=wx.Size(400, 498),
style=wx.DEFAULT_DIALOG_STYLE, title='Dialog1')
in other file Frame - wx.Frame with button
self.button1.Bind(wx.EVT_BUTTON, self.Dec, id=wxID_FRAME3BUTTON1)
and method to show Dialog
def Dec(self, event):
import Dialog1
self.dialog = Dialog1(self)
self.dialog.ShowModal()
#dialog.Destroy()
return True
and When I Push this Button i have a error;
TypeError: 'module' is not Callable
Why?, please Help Me
Edit: Ok is work now, to much copy-paste method ... Sorry
REMOVE THIS QUESTION
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“'module' is not Callable”错误通常意味着您做了这样的事情:
...当您应该做类似的事情时:
换句话说,您在导入整个库的地方有一个错误的导入语句而不是该模块中的类或函数。
我的猜测是,您有一个名为 Dialog1.py 的文件,其中包含 Dialog1 类。这意味着你需要做:
"'module' is not Callable" errors typically mean you did something like this:
... when you should have done something like:
In other words, you've got a bad import statement somewhere, where you're importing a whole library rather than a class or function from that module.
My guess is, you have a file named Dialog1.py that has the class Dialog1 in it. Which means you need to do: