zu Beginn sollte ich sagen, dass ich im Programmieren kompletter Neuling bin, weshalb es schön wäre, wenn ihr mir eine einfache Lösung bzw. Tipps geben könntet

Vielen Dank jetzt schon mal für die Antworten.
Code: Alles auswählen
from tkinter import *
from tkinter import Canvas
from random import randint
a=100
b=100
c=120
d=120
fenster = Tk()
fenster.title('Canvas Test')
fenster.geometry('600x600')
canvas = Canvas(fenster, background='grey')
canvas.place(x=10, y=10, width=580, height=580)
kreis = canvas.create_oval(a, b, c, d, fill='blue')
def move_left(event):
(x0, y0, x1, y1) = tuple(canvas.coords(kreis))
if x0 >= 10:
canvas.coords(kreis, (x0-10, y0, x1-10, y1))
fenster.bind('<KeyPress-Left>', move_left)
def move_right(event):
(x0, y0, x1, y1) = tuple(canvas.coords(kreis))
if x1 <= 580:
canvas.coords(kreis, (x0+10, y0, x1+10, y1))
fenster.bind('<KeyPress-Right>', move_right)
def move_down(event):
(x0, y0, x1, y1) = tuple(canvas.coords(kreis))
if y1 <= 580:
canvas.coords(kreis, (x0, y0+10, x1, y1+10))
fenster.bind('<KeyPress-Down>', move_down)
def move_up(event):
(x0, y0, x1, y1) = tuple(canvas.coords(kreis))
if y0 >= 10:
canvas.coords(kreis, (x0, y0-10, x1, y1-10))
fenster.bind('<KeyPress-Up>', move_up)