设置控件上的文字
-
先修科目
介绍
下面介绍2个积木,用来更改控件上的文字。
直接改成别的文字
这个积木用来设置控件的值。注意:对于不同的控件,“值”就代表不同的东西。对于标签而言,“值”就是上面的文字,所以当我们为标签控件设置一个新值,新值就会替代标签上的现有文字:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ccac2ea5-8225-4bdf-a2ce-958e5f93237d.png" width="300" style="">
参数
- 新值:为控件(比如标签)设置的新值。
- 控件名称:要选择更改哪个控件。必须先把控件添加到舞台中,其名称才会出现于下拉列表中。
在现有文字后面增添文字
这个积木会保留控件上的现有文字,并在后面增添文字:
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/7d8f0ec8-47b7-4468-8b5b-c37ef09e354f.png" width="300" style="">
参数
- 要增添的文字:要增添的文字字符串。
- 控件名称:要选择更改哪个控件。必须先把控件添加到舞台中,其名称才会出现于下拉列表中。
范例
下方录屏展示了如何用这2个积木更改标签上的文字。
https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/8fd5c0c1-3fc7-46de-ba04-505878877e52.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login