# Make text appear and stay on screen

**URL:** <https://forum.code.org/t/make-text-appear-and-stay-on-screen/31895>\
**Category:** Unit and Lesson Discussion\
**Created:** [December 11, 2019, 3:58pm UTC](https://forum.code.org/t/make-text-appear-and-stay-on-screen/31895 "2019-12-11T15:58:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![buyskej](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/buyskej/32/2108_2.png) [@buyskej](https://forum.code.org/u/buyskej)\
**Post date:** [December 11, 2019, 3:58pm UTC](https://forum.code.org/t/make-text-appear-and-stay-on-screen/31895/1 "2019-12-11T15:58:29Z")

</div>

I have a student who is trying to have text appear on screen after clicking the mouse button and stay there. Right now, the text will appear but does not stay on the screen. This is her current code: [https://studio.code.org/projects/gamelab/ZGradt40NzJNx9U8vMh9JXg6F6j\_A7O7q76aloz73aQ](https://studio.code.org/projects/gamelab/ZGradt40NzJNx9U8vMh9JXg6F6j_A7O7q76aloz73aQ)

Any suggestions?

My workaround for her right now is to create a sprite with the same color as the background and cover the text. Then control the sprite’s visibility with the click, but there has to be an easier way.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [December 11, 2019, 11:41pm UTC](https://forum.code.org/t/make-text-appear-and-stay-on-screen/31895/2 "2019-12-11T23:41:24Z")

</div>

Good idea for an interactive card! I’m sure there are a number of ways to do this.

My solution was to create a variable called _gender_ that is set to “” at the beginning of the program (var gender=""). Then, at the same place you draw the background, have it display the text in blue and size 50. When the program starts, it will display nothing because there is no value to it.

Then, in the if loop, change the value of gender to equal “Boy” and now, everytime the background is drawn, it will “redraw” the text as well.

[Here’s a link to my version](https://studio.code.org/projects/gamelab/nq_NRHPWXr64RrPY4RWjKVRcO92RfMDCMQGq8_rwarU) if you are interested …

Mike

---

<div class="post-metadata">

**Author:** ![buyskej](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/buyskej/32/2108_2.png) [@buyskej](https://forum.code.org/u/buyskej)\
**Post date:** [December 12, 2019, 3:09pm UTC](https://forum.code.org/t/make-text-appear-and-stay-on-screen/31895/3 "2019-12-12T15:09:31Z")

</div>

Thank you, Mike! That’s exactly what we were looking for. I never think to use variables in the text block for things like that. Great idea!
