STEP 8: The rectangle's width changed once, but doesn't continue to change. Why not?

Look at ····my_rect.set_width(50)¬. Every time the mouse moves, my_rect’s width gets set to 50, so it never changes width again! It’s always 50. To make the width change, we need to use a variable that changes. We’ll use the x-coordinate of the mouse since it changes whenever the mouse moves.

  • Change the argument in .set_width() from 50 to x.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)