First, make sure that you can run the circle.py code,
then do the following.
Add commands to animate an expanding circle, with radius starting at 0 and growing.
The pattern for animations is as follows.
while animation is running:
Draw a frame of the animation.
Modify the image state for the next animation frame.
canvas.after(rate)
canvas.update()
Add mouse event code to start new circles. Each circle should:
The pattern for handing mouse-click events is as follows.
# Put this in the main GUI constructor.
self._window.bind('<Button-1>', mouse event handler)
# Add this event handler method.
def method name(self, event):
print("Clicked at: ", event.x, event.y)
Modify the state of the animation.
Add a keypress event handler that moves the current circle up, down, right or left based on the arrow keys.
The pattern for handing key-click events is as follows.
# Put this in the main GUI constructor.
self._window.bind('<Key>', key event handler method name)
# Add this event handler method.
def method name(self, event):
print('Symbolic name of the key: ', event.keysym)
Modify the state of the animation.
Symbolic names include: “Left”, “Right”, “Up”, “Down”,“Return”,“space”.