I\'m new in python. I\'m trying to achieve a simple object movement on canvas.
The idea is to simply update X, Y coordinates and redraw the oval.
I\'ve tried
**Please note: none of this code will work - it's just here to give you ideas about how to do stuff. :)
I've had objects bound to the keyboard that move around the screen when buttons are pressed.
instead of a loop, you can just change the x and y of an object with config and bind... when you press left on the keyboard the def will be run which moves the thing. (or things)
def move_object_left()...
object.config(move left...)
example of binding something:
entry.bind('', lambda event: self.maximise_keyboard(event.widget))
x_var = 5 y_var = 9
**Bind an object to the keyboard here:
*On_key_press('RIGHT'):
x_var = x_var + 5
object.config(x = x_var)
You can move a bunch of stuff at once if you want... (though you will have to do the code yourself lol)
list_of_stuff = [tree, bush, snail]
for entry in list_of_stuff:
...
**Get object X and Y of the object...
** add a number to this X and Y...