WxPython - Dialog, module object is not Callable
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
"'module' is not Callable" errors typically mean you did something like this:
import Foo
...
foo = Foo()
... when you should have done something like:
from Foo import Foo
...
foo = Foo
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:
from Dialog1 import Dialog1
...
self.dialog = Dialog1(self)
精彩评论