title: python - unbound method must be called with instance as first argument (got nothing instead)
body: <p>I am trying to make a log in form which let's the user go to the sign up form if he/she doesn't have an account yet. Here is my code.</p>
  
  <p>from Tkinter import *</p>
  
  <pre><code>class myLogin():
  def __init__(self):
      self.form = Tk()
      self.form.title("Log in")
      self.form.option_add("*font",("Arial",12,"normal"))
      self.form.geometry("500x400+430+200")
      self.frm = Frame(self.form, width = 700, height = 500)
      self.lab1 = Label(self.frm, text="Username:")
      self.lab1.grid(row=0,sticky=W)
      self.entr1 = Entry(self.frm, width = 15)
      self.entr1.focus_set()
      self.entr1.grid(row=0, column=1, sticky=W)
  
      self.lab2 = Label(self.frm, text="Password:")
      self.lab2.grid(row=1, sticky=W)
  
      self.entr2 = Entry(self.frm, width=15, show='*')
      self.entr2.grid(row=1, column=1, sticky=W)
  
      checkbox = Checkbutton(self.frm, text="Keep me logged in")
      checkbox.grid(column=1,columnspan=2)
  
      self.btn2 = Button(self.frm, text = "Log-in", command = self.login, width=10)
      self.btn2.grid(row=3, sticky = E, columnspan = 2)
  
      self.lab3 = Label(self.frm, text="Don't have an account?")
      self.lab3.grid(row=4,column=1)
      self.btn3 = Button(self.frm, text = "Register", command = mySignUp.register, width=10)
      self.btn3.grid(row=5, column = 0, columnspan = 2)
  
      self.frm.pack()
      self.form.mainloop()
  
  
  
  def login(self):
      user=[]
      pw=[]
      ctr=0
  
      with open('users.txt', 'r') as f:
          for line in f:
              for word in line.split():
                  if(ctr%2==0):
                      user.append(word)
                  else:
                      pw.append(word)
                  ctr+=1
  
      userctr=0;
      for eachuser in user:
          if((user[userctr] == self.entr1.get()) and (pw[userctr]== self.entr2.get())):
              print("ok")
              userctr+=1
  
  class mySignUp(myLogin):
  def register(self):
      #self.destroy()
      root = Tk()
      top = Toplevel(root)
  
      top.title("Register")
      top.geometry("500x400+430+200")
  
      top.transient(root)
      top.lab1 = Label(top, text="Username:")
      top.lab1.grid(row=0,sticky=W)
      top.inpusername = Entry(top, width = 15)
      top.inpusername.focus_set()
      top.inpusername.grid(row=0, column=1, sticky=W)
  
      top.lab2 = Label(top, text="Password:")
      top.lab2.grid(row=1, sticky=W)
  
      top.inppw = Entry(top, width=15, show='*')
      top.inppw.grid(row=1, column=1, sticky=W)
  
      top.btn2 = Button(top, text = "Sign up", command = self.addUser, width=10)
      top.btn2.grid(row=3, sticky = E, columnspan = 2)
  
      #top.lab1.pack()
      #top.form.mainloop()
      root.mainloop()
  
  def addUser(self):
      ob = register()
      import cgi
      form = cgi.FieldStorage()
      print 
      username = ob.top.inpusername.get()
      password = ob.top.inppw.get()
      print(username)
      print(password)
      #print "The user entered %s" % form.getvalue("entr1")
  
  
  
  if __name__ == "__main__":
      app = myLogin()
      #login()
      #window = Window(None)
  
      #window.title("title")
  
      #window.mainloop()
  </code></pre>
  
  <p>When the user click the register button, it should call the register method at class mySignUp() and the sign up form should pop up
  But I am getting this error</p>
  
  <p>Exception in Tkinter callback
  Traceback (most recent call last):</p>
  
  <p>File "C:\Python27\lib\lib-tk\Tkinter.py", line 1536, in <strong>call</strong>
      return self.func(*args)
  TypeError: unbound method register() must be called with mySignUp instance as first argument (got nothing instead)</p>
  
  <p>What could be wrong?</p>