Canvas class of Tkinter supports a functions which is used to move objects from one position to another in any canvas or tkinter toplevel.
Syntax: Canvas.move(canvas_object, x, y)
canvas_object is any valid image or drawing created with the help of Canvas class. To know how to create object using Canvas class take reference of this.
x is horizontal distance from upper-left corner.
y is vertical distance from upper-left corner.
We will use class to see the working of
Data members used:
Member functions used:
Widgets used: Canvas
Tkinter method used:
Below is the Python implementation:
Extra print statements are used in above code to show the proper working of move() method. keysym keyword (Tkinter reserved) is used to print which keyboard key is pressed.
- Python | after method in Tkinter
- Python | pack() method in Tkinter
- Python | place() method in Tkinter
- Python | grid() method in Tkinter
- destroy() method in Tkinter | Python
- minsize() method in Tkinter | Python
- maxsize() method in Tkinter | Python
- Python | geometry method in Tkinter
- iconphoto() method in Tkinter | Python
- resizable() method in Tkinter | Python
- Python Tkinter | grid_location() and grid_size() method
- Python | forget_pack() and forget_grid() method in Tkinter
- Python GUI - tkinter
- Different messages in Tkinter | Python
- RadioButton in Tkinter | Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.