wxPythonフレームを作成するWxFrameというクラスがあります。私はPyDEPPクラスのオブジェクトである自己とpydeppを受けcreateRunButtonと呼ばれる方法を、追加wx.Buttonのバインドを使用する場合のPython TypeError
import wx
class WxFrame(wx.Frame):
def __init__(self, parent, title):
super(WxFrame, self).__init__(parent, title=title)
self.Maximize()
self.Show()
def createRunButton(self,pydepp):
#pydepp.run()
self.runButton = wx.Button(self, label="Run")
self.Bind(wx.EVT_BUTTON, pydepp.run, self.runButton
これはPyDEPPクラスです:私はインスタンス化して、それを実行
class PyDEPP:
def run(self):
print "running"
:
import wx
from gui.gui import WxFrame
from Depp.Depp import PyDEPP
class PyDEPPgui():
"""PyDEPPgui create doc string here ...."""
def __init__(self,pydepp):
self.app = wx.App(False)
##Create a wxframe and show it
self.frame = WxFrame(None, "Cyclic Depp Data Collector - Ver. 0.1")
self.frame.createRunButton(pydepp)
self.frame.SetStatusText('wxPython GUI successfully initialised')
if __name__=='__main__':
#Launch the program by calling the PyDEPPgui __init__ constructor
pydepp = PyDEPP()
pydeppgui = PyDEPPgui(pydepp)
pydeppgui.app.MainLoop()
上記のコードを実行するとエラーが発生します。 TypeError:run()は1つの引数(2が指定された)をとります
しかし、バインドをコメントアウトしてpydepp.run()行のコメントを外しても問題ありません。
答えは明らかですが、私はCompSciまたはOOコーディングを学んだことはありません。