TypeError when using tkinter (python)
Question: I´ve written a testprogram to simulate my error. Here´s the code:

    
    
    from random import *
    from tkinter import *
    
    class match:
        def __init__(self):
            self.players = 4*[None]
    
        def commandos(self):
            print("show commands:")
            print("now commands for you!")
    
        def choice(self, choose):
            print("No choice")
    
    class Application(Frame):
    
        def __init__(self, master, match):
            Frame.__init__(self, master)
            self.grid()
            self.create_widgets()
            self.match = match
            self.match.commandos()
    
        def create_widgets(self):
            self.submit_button = Button(self, text = "Submit", command = self.button_click)
            self.submit_button.grid(row = 2, column = 0, sticky = W)
    
            self.entry = Entry(self)
            self.entry.grid(row = 1, column = 1, sticky = W)
    
        def button_click(self):        
            choose = self.entry.get()
            while choose != 'S':
                self.match.choice(choose)
                choose = input()
    
    root = Tk()
    root.title("StackQuestion")
    root.geometry("250x150")
    app = Application(root, match)
    
    root.mainloop()
    

When I run it I get this error:

    
    
    Traceback (most recent call last):
      File "H:/Dropbox/Programmering/Python/stachquestion.py", line 40, in <module>
        app = Application(root, match)
      File "H:/Dropbox/Programmering/Python/stachquestion.py", line 22, in __init__
        self.match.commandos()
    TypeError: commandos() missing 1 required positional argument: 'self'
    

How do I fix this? I need to fix this so I can use a GUI in my tennisprogram
which I´m working on.


Answer: You did not created match object. (missing `()`)

Replace following line:

    
    
        self.match = match
    

with

    
    
        self.match = match()
    

