PREVIEW: This is an example of the Etch-a-Sketch game you will make today!

  • Click Run to start the game. Use the left, right, up, and down arrow keys on your keyboard to draw.
  • Press your spacebar to change the color, and click the stage to change the pen width.
  • After you finish drawing, click Submit and Next to build an Etch-a-Sketch yourself!

Click Submit and Next after every activity in this lesson to move to the next activity.

stage.set_background_color("black") sprite = codesters.Point(50, 100) sprite.pen_down() sprite.set_color("red") # Allow the user to move the point right, left, up, down def left_key(): sprite.move_left(20) stage.event_key("left", left_key) def right_key(): sprite.move_right(20) stage.event_key("right", right_key) def down_key(): sprite.move_down(20) stage.event_key("down", down_key) def up_key(): sprite.move_up(20) stage.event_key("up", up_key) # Allow the user to change the color of the pen randomly colors = ["green", "red", "yellow", "orange", "pink", "lightblue"] def space_bar(): pen_color = random.choice(colors) sprite.set_color(pen_color) sprite.set_say_color("white") sprite.say("Space bar!", 0.2) stage.event_key("space", space_bar) # Allow the user to change the width of the pen randomly def w_key(): pass # delete after adding indented code width = int(sprite.ask("Enter a number for the width!")) sprite.pen_width(width) sprite.set_say_color("white") sprite.say("New Width!", 0.2) # add other actions... stage.event_key("w", w_key)