TypeError: overlaps() missing 3 required positional arguments: 'y1', 'x2', and 'y2'
TypeError: overlaps() missing 3 required positional arguments: 'y1', 'x2', and 'y2'
我正在 python 使用 tkinter 和 find_overlap 函数制作一个程序,这里是我的代码。
from tkinter import *
import tkinter.messagebox
root = Tk()
coords = 1447, 474
canvas = Canvas(root, width=1480, height=960)
frame = Frame(root, width=209, height=960)
def cords(event):
print(event.x, event.y)
def click(event):
canvas_id = canvas.create_line(event.x, event.y, coords)
canvas.after(100,canvas.delete,canvas_id)
line = click
obj1=canvas.create_rectangle(605,482,247,157)
obj2=canvas.create_rectangle(802,720,270,640)
objoverlap2=canvas.find_overlapping(802,720,1082, 473)
canvas.bind('<Button-1>',line)
photo = PhotoImage(file='76.gif')
label = Label(frame, image=photo)
label.config(image=photo)
label.pack()
frame.pack(side='right')
canvas.pack(side='left')
while True:
canvas.find_overlapping(605,156,247,482)!=line
root.mainloop()
当我 运行 这段代码时,我得到了这个错误
TypeError: overlaps() missing 3 required positional arguments: 'y1', 'x2', and 'y2'
然而在最后一个循环中,它说的是错误。此外,我不会在代码中调用 overlaps() ,这更加令人困惑。
更新 我刚刚注意到它出现在第 39 行,这很奇怪,因为我没有第 39 行
对于我的错误,我只是搞乱了输入要求,以防那些想知道它与您在代码中输入的相同信息来制作矩形
我正在 python 使用 tkinter 和 find_overlap 函数制作一个程序,这里是我的代码。
from tkinter import *
import tkinter.messagebox
root = Tk()
coords = 1447, 474
canvas = Canvas(root, width=1480, height=960)
frame = Frame(root, width=209, height=960)
def cords(event):
print(event.x, event.y)
def click(event):
canvas_id = canvas.create_line(event.x, event.y, coords)
canvas.after(100,canvas.delete,canvas_id)
line = click
obj1=canvas.create_rectangle(605,482,247,157)
obj2=canvas.create_rectangle(802,720,270,640)
objoverlap2=canvas.find_overlapping(802,720,1082, 473)
canvas.bind('<Button-1>',line)
photo = PhotoImage(file='76.gif')
label = Label(frame, image=photo)
label.config(image=photo)
label.pack()
frame.pack(side='right')
canvas.pack(side='left')
while True:
canvas.find_overlapping(605,156,247,482)!=line
root.mainloop()
当我 运行 这段代码时,我得到了这个错误
TypeError: overlaps() missing 3 required positional arguments: 'y1', 'x2', and 'y2'
然而在最后一个循环中,它说的是错误。此外,我不会在代码中调用 overlaps() ,这更加令人困惑。 更新 我刚刚注意到它出现在第 39 行,这很奇怪,因为我没有第 39 行
对于我的错误,我只是搞乱了输入要求,以防那些想知道它与您在代码中输入的相同信息来制作矩形