Search code examples
pythonpython-2.7wxpython

Python: Unbound Methods


To preface here is the error I receive:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "TestR.py", line 13, in __init__ wx.Frame.__init__(self, parent = None, title = "Input Data", size = (1250, 750)) TypeError: unbound method __init__() must be called with Frame instance as first argument (got nothing instead)

when I type in this:

j = Test(None, "hello")

with this code:

  import wx


class Test(wx.Frame):

def __init__(self, parent, title):
    wx.Frame.__init__(self, parent = None, title = "Input Data", size = (1250, 750))

Solution

  • Add these lines.

    import wx
    
    app = wx.App(False)
    Test(None, "hello")
    app.MainLoop()