STEP 8:矩形的宽度改变了一次,但不会继续改变。为什么不?

看看···· my_rect设置宽度( 50 ¬ 。每次鼠标移动时, my_rect的宽度都会设置为 50,因此它永远不会再改变宽度!它总是 50。要改变宽度,我们需要使用一个改变的变量。我们将使用鼠标的 x 坐标,因为它会随着鼠标移动而改变。

  • .set_width()中的参数从50更改为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
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)