Javier Sandoval
Javier Sandoval

Reputation: 507

Unexpected paint behavior

I want to use a paint command but think have a file problem, not a code problem. This is the code:

to color-white
 if mouse-down?
   [ask patch mouse-xcor mouse-ycor
       [ set pcolor white]]
end

It simply paints in real time when the left mouse button is pushed and pointer passes over the screen. The code works if its written in a new Netlogo session. But if it's used in this file:

paint-white.nlogo

paint won't appear in real time. Please help.

Upvotes: 2

Views: 44

Answers (2)

Seth Tisue
Seth Tisue

Reputation: 30453

I'd suggest adding a call to display in your code whenever you want the display to update. That's how the models in the NetLogo Models Library do it.

"continuous" view updates is a somewhat reasonable alternative, but it involves giving up all control of when view updates occur.

Upvotes: 2

Javier Sandoval
Javier Sandoval

Reputation: 507

Problem solved: changed view updates from "on ticks" to "continuous".

Upvotes: 1

Related Questions