R
R
Roma Kotolup2021-03-25 15:19:20
Python
Roma Kotolup, 2021-03-25 15:19:20

How to change canvas coordinates in python tkinter using itemconfig?

How to change canvas coordinates in python tkinter using itemconfig?
my code:

the code
from tkinter import *
def new_size(canvas, size, my_object):
    canvas.itemconfig(my_object, 10, 10, 90, 90)
if __name__ == '__main__':
    root = Tk()
    canvas = Canvas(root, width=500, height=500)
    canvas.grid()
    red = canvas.create_rectangle(20, 20, 100, 100)
    new_size(canvas, 0, red)

and error:
mistake
TypeError: itemconfigure() takes from 2 to 3 positional arguments but 6 were given

how to do it without error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
o5a, 2021-03-25
@roma2

canvas.coords(my_object, 10, 10, 90, 90)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question