D
D
Dima_dawefwf2021-12-16 08:23:19
Python
Dima_dawefwf, 2021-12-16 08:23:19

TypeError: move() takes 0 positional arguments but 1 was given how to solve?

Hello, I get this error in the TypeError code: move() takes 0 positional arguments but 1 was given I wanted to make a program in which the button would change its position when hovering over it, but the problem got out

here Code:
from tkinter import *
import random
root=Tk( )
root.title("KnOpKa")
root.geometry('400x400')

def move():
x = random.randint(0,180)
y = random.randint(0,200)
b1.pack(padx=x, pady=y)

b1=Button(root, text="gg",command=move)
b1.pack(padx=100, pady=180)

b1.bind("", move)
b1.bind('', move)

root.mainloop( )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Nagibovich, 2021-12-16
@nki

Your problem is googled at times.
bind example
Your move function must have an argument.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question