Jan-15-2022, 01:26 PM
"self" is used to accept the instance argument in an instance method call just as "cls" is used to accept the class argument for a class method. The words "self" and "cls" are conventions and the arguments could be named anything, but it is best to follow conventions.
In Python you call an instance method like this "instance.method(args)" where "instance" is an instance of a class, "method" the name of the instance method, and args are whatever additional arguments are passed. Python converts this to "class.method(instance, args)" prepending the instance as the first argument to the method call. The instance argument becomes "self" inside the body of the method.
I think "update_main_tasks()" is a function, not a method and it should not have a "self" argument. When you bind this function to a tkinter widget, the function gets called with an argument, probably a tuple containing information about the event that caused the function to be called. You should find out what this information is. If you don't need the information you should modify the binding to not pass the argument. This is easily done using a lambda expression.
In Python you call an instance method like this "instance.method(args)" where "instance" is an instance of a class, "method" the name of the instance method, and args are whatever additional arguments are passed. Python converts this to "class.method(instance, args)" prepending the instance as the first argument to the method call. The instance argument becomes "self" inside the body of the method.
I think "update_main_tasks()" is a function, not a method and it should not have a "self" argument. When you bind this function to a tkinter widget, the function gets called with an argument, probably a tuple containing information about the event that caused the function to be called. You should find out what this information is. If you don't need the information you should modify the binding to not pass the argument. This is easily done using a lambda expression.
button = tk.Button(root, command=lambda event:update_main_tasks())