Is there a way to hide the painter

A students is doing his project for Unit 1 Lessons 16-18. He wants to hide the painter once the picture is drawn. Is there a way to hide the painter? - Randle

1 Like

If you’re talking about on App Lab, then yes. The hide() block does just that.

If you’re talking about Artist, however, then what you should probably do is have him leave the screen once the picture is drawn.

@randle.moore - Hi Randle, how is your year going? Thanks for the inquiry. Unfortunately, there is not a way to hide the Painter object in Java Lab. I personally think that would be a great addition.

1 Like

The year is going fine. I’m a hamster on a wheel. Thanks, I pass this on to my student.

Hi Randle, good to see you on the forum!
This request to hide the painter has been suggested, I think they are considering adding it to the Painter class as the curriculum is updated. One way to pass that request along is to email support@code.org, or to use the rate this lesson button on the unit overview.

-Lindsay

1 Like

Does anyone know if this has been added? I had a student ask me about hiding a painter object today and I don’t see anything about it in the documentation yet.

@amber_inscoe - Good question - I will check with the curriculum team and post their answer when I receive one.

Sylvia

Hi Amber,
Sylvia might hear back more info with the curriculum team, but my understanding is that you cannot hide the Painter. I had a student who went through the documentation and tried several things, and it wasn’t possible with what he tried.

Best,
Lindsay

1 Like

It seems the hide functionality no longer exists as a block, however it seems you can still get rid of the drawer by doing this
image
though it probably will crash the program and prevent future drawing in the program until it is either reset or ran again

Hi @varrience , thank you for your input on this question! This is in the CSA Java lab course, which does not have block code, I don’t think this approach would work with the Painter in the CSA unit 1 content. But please reply back if I’m mistaken :slight_smile:

Best,
Lindsay

1 Like

It Seems you are correct my apologies, i had thought this topic was initially about the artist drawer program however i don’t have access to the current lesson program unfortunately so i currently am unable to provide an adequate solution at the moment however perhaps this could be used in the same way however that does not seem possible you’d have to do a lot of searching in the painter git to make something within an in house solution

though i doubt you want something like that so i think this may be a bit better


by looking at pegman-painter-<id> you can remove all of them via inspect element

all other solutions requires reading all class structures that painter interacts with and which one assigns the avatar to it to possibly remove it

1 Like

Further Looking Into this i found this method in the class that isn’t documented or wasn’t in the official CDO painter java documentation which can be found here https://studio.code.org/docs/ide/javalab/classes/Painter

  /** Hides the painter on the screen. */
  public void hidePainter() {
    this.sendOutputMessage(NeighborhoodSignalKey.HIDE_PAINTER, this.getSignalDetails());
  }

i must have been so tired last night that i must have glanced over it, it seems that the inital hide has moved to hidePainter as you can see it is a void function that requires no arguments sub-sequentially there is also a showPainter method that allows the painter to disappear or reappear based on your preference, hope this helps

Varrience

3 Likes

@amber_inscoe

Unfortunately, the ability to hide a painter has not been added to the latest version. This is something the curriculum team is aware of. There is not a set date as to when this update may appear.

1 Like

Thanks for doing that leg work!

For those who are following this thread, I tested the hide and show painter methods @varrience described, and they worked :slight_smile:
I will probably not make a big deal out of these methods throughout the unit. One tricky aspect to hiding a painter that I found is you can have a hidden painter still move and paint! I think that at the beginning of the year with new programmers, it might be best to keep their painters in view on the screen.

The exception I see is for the unit 1 project. I have students copy and paste their final asphalt art into a shared doc and then print it out and hang it up. Many of them want to hide their painters to make the final image look cleaner.

Here is a screenshot of a simple program I typed up to test the show and hide painter methods. The blue square was painted by an invisible “ghost” painter, who then re-appeared.

Best,
Lindsay

2 Likes

Great find @varrience!