Vous devez modifier le programme ci-dessous afin :
from guizero import App, Drawing x,y=50,50 dx,dy=10,5 def do_animation(): global x,y,dx,dy x+=dx y+=dy #drawing.clear() drawing.rectangle(x, y, x+10, y+10, color="blue") def do_this(event_data): print("key pressed : "+ event_data.key) app = App() drawing = Drawing(app,height=300, width=300) drawing.bg="grey" drawing.repeat(20,do_animation) app.when_key_pressed = do_this app.display()
( Christophe Béasse - Octobre 2019 )