0

I need some help over here!

import tkinter as tk


class CountVisitors:
    def __int__(self, master):
        self.master = master

        self.button1 = tk.Button(self.master, text="Count", command=self.counting)

        self.button1.pack(side=tk.LEFT)

        self.button_click = 0

    def counting(self):
        self.button_click += 1
        print(self.button_click)


def main():
    root = tk.Tk()
    CountVisitors(root)
    root.mainloop()


if __name__ == "__main__":
    main()

when I try to run this code, it prompts me an error message:

Traceback (most recent call last): 
    File "C:/Users/Anson/PycharmProjects/improvement/improvement.py", line 26, in <module> main() 
    File "C:/Users/Anson/PycharmProjects/improvement/improvement.py", line 21, in main CountVisitors(root) 
    TypeError: object() takes no parameters

What does it mean?

4
  • Which line raises the error? Commented Jul 4, 2017 at 10:49
  • Traceback (most recent call last): File "C:/Users/Anson/PycharmProjects/improvement/improvement.py", line 26, in <module> main() File "C:/Users/Anson/PycharmProjects/improvement/improvement.py", line 21, in main CountVisitors(root) TypeError: object() takes no parameters Commented Jul 4, 2017 at 10:49
  • I am so confused. Commented Jul 4, 2017 at 10:50
  • get into the habit of including the full traceback. Without it we have to run the program ourselves. Commented Jul 4, 2017 at 10:50

1 Answer 1

2

Your __init__ is misspelled (missing an 'i').

change the line:

def __int__(self, master):

to:

def __init__(self, master):
Sign up to request clarification or add additional context in comments.

2 Comments

Remember to accept the answer if it solved your problem. :)
Yes! Thank you so much!:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.