function takes 1 positional argument but 2 were given python code example

Example 1: 1 positional arguments expected but 2 were given

#Happens when a function expects only 1 value to be passed through it
#But multiple are passed through

class thing(object):
	def __init__(self):
    	pass
       
    def function(self)
		print("hello")

thingy = thing()
thingy.bind("<KeyPress>", thingy.function)

#You don't expect above to pass two values through, however it passes an event
#and self which is why it will give a positional argument error

Example 2: takes 1 positional argument but 2 were given python

This error is often caused by the fact that the self is omitted as a parameter in the method of the class.

https://careerkarma.com/blog/python-takes-one-positional-argument-but-two-were-given/#:~:text=Conclusion,the%20methods%20in%20a%20class.
0

Example 3: takes 2 positional arguments but 3 were given

# just put self in other functions like this
class myclass:
  def __init__(self, parameter):
  	self.parameter = parameter
  def function(self, otherparameter):
    # put a self ^ there
    print(self.parameter + otherparameter)

object=myclass(1)
object.function(2)
# output is 3