Unexpected paint behavior












2















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.










share|improve this question

























  • I don't think your file loaded. Could you show all of your code? What do you mean it's not painting in real-time? I think your issue is that your color-white function needs to be continuously run. You could run continuously this command in a button in the UI.

    – mattsap
    Dec 29 '18 at 19:21













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

    – Javier Sandoval
    Dec 29 '18 at 19:23
















2















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.










share|improve this question

























  • I don't think your file loaded. Could you show all of your code? What do you mean it's not painting in real-time? I think your issue is that your color-white function needs to be continuously run. You could run continuously this command in a button in the UI.

    – mattsap
    Dec 29 '18 at 19:21













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

    – Javier Sandoval
    Dec 29 '18 at 19:23














2












2








2








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.










share|improve this question
















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.







netlogo paint






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '18 at 19:20









Ali Heikal

1,0722316




1,0722316










asked Dec 29 '18 at 18:43









Javier SandovalJavier Sandoval

15812




15812













  • I don't think your file loaded. Could you show all of your code? What do you mean it's not painting in real-time? I think your issue is that your color-white function needs to be continuously run. You could run continuously this command in a button in the UI.

    – mattsap
    Dec 29 '18 at 19:21













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

    – Javier Sandoval
    Dec 29 '18 at 19:23



















  • I don't think your file loaded. Could you show all of your code? What do you mean it's not painting in real-time? I think your issue is that your color-white function needs to be continuously run. You could run continuously this command in a button in the UI.

    – mattsap
    Dec 29 '18 at 19:21













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

    – Javier Sandoval
    Dec 29 '18 at 19:23

















I don't think your file loaded. Could you show all of your code? What do you mean it's not painting in real-time? I think your issue is that your color-white function needs to be continuously run. You could run continuously this command in a button in the UI.

– mattsap
Dec 29 '18 at 19:21







I don't think your file loaded. Could you show all of your code? What do you mean it's not painting in real-time? I think your issue is that your color-white function needs to be continuously run. You could run continuously this command in a button in the UI.

– mattsap
Dec 29 '18 at 19:21















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

– Javier Sandoval
Dec 29 '18 at 19:23





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

– Javier Sandoval
Dec 29 '18 at 19:23












2 Answers
2






active

oldest

votes


















2














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.






share|improve this answer
























  • Can you elaborate more on your suggestion, please?

    – Javier Sandoval
    Jan 8 at 4:10











  • In what way? What seems unclear or incomplete?

    – Seth Tisue
    Jan 8 at 22:22











  • see also the doc at ccl.northwestern.edu/netlogo/docs/programming.html#view-updates which goes into this stuff fairly thoroughly

    – Seth Tisue
    Jan 8 at 22:32











  • What is unclear is what you mean by saying "adding a call to display"

    – Javier Sandoval
    Jan 9 at 5:33











  • literally insert display in your code in places where you want the view updated. see ccl.northwestern.edu/netlogo/docs/dictionary.html#display

    – Seth Tisue
    Jan 9 at 15:51





















1














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






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53972374%2funexpected-paint-behavior%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    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.






    share|improve this answer
























    • Can you elaborate more on your suggestion, please?

      – Javier Sandoval
      Jan 8 at 4:10











    • In what way? What seems unclear or incomplete?

      – Seth Tisue
      Jan 8 at 22:22











    • see also the doc at ccl.northwestern.edu/netlogo/docs/programming.html#view-updates which goes into this stuff fairly thoroughly

      – Seth Tisue
      Jan 8 at 22:32











    • What is unclear is what you mean by saying "adding a call to display"

      – Javier Sandoval
      Jan 9 at 5:33











    • literally insert display in your code in places where you want the view updated. see ccl.northwestern.edu/netlogo/docs/dictionary.html#display

      – Seth Tisue
      Jan 9 at 15:51


















    2














    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.






    share|improve this answer
























    • Can you elaborate more on your suggestion, please?

      – Javier Sandoval
      Jan 8 at 4:10











    • In what way? What seems unclear or incomplete?

      – Seth Tisue
      Jan 8 at 22:22











    • see also the doc at ccl.northwestern.edu/netlogo/docs/programming.html#view-updates which goes into this stuff fairly thoroughly

      – Seth Tisue
      Jan 8 at 22:32











    • What is unclear is what you mean by saying "adding a call to display"

      – Javier Sandoval
      Jan 9 at 5:33











    • literally insert display in your code in places where you want the view updated. see ccl.northwestern.edu/netlogo/docs/dictionary.html#display

      – Seth Tisue
      Jan 9 at 15:51
















    2












    2








    2







    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.






    share|improve this answer













    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.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 2 at 20:42









    Seth TisueSeth Tisue

    23.4k961125




    23.4k961125













    • Can you elaborate more on your suggestion, please?

      – Javier Sandoval
      Jan 8 at 4:10











    • In what way? What seems unclear or incomplete?

      – Seth Tisue
      Jan 8 at 22:22











    • see also the doc at ccl.northwestern.edu/netlogo/docs/programming.html#view-updates which goes into this stuff fairly thoroughly

      – Seth Tisue
      Jan 8 at 22:32











    • What is unclear is what you mean by saying "adding a call to display"

      – Javier Sandoval
      Jan 9 at 5:33











    • literally insert display in your code in places where you want the view updated. see ccl.northwestern.edu/netlogo/docs/dictionary.html#display

      – Seth Tisue
      Jan 9 at 15:51





















    • Can you elaborate more on your suggestion, please?

      – Javier Sandoval
      Jan 8 at 4:10











    • In what way? What seems unclear or incomplete?

      – Seth Tisue
      Jan 8 at 22:22











    • see also the doc at ccl.northwestern.edu/netlogo/docs/programming.html#view-updates which goes into this stuff fairly thoroughly

      – Seth Tisue
      Jan 8 at 22:32











    • What is unclear is what you mean by saying "adding a call to display"

      – Javier Sandoval
      Jan 9 at 5:33











    • literally insert display in your code in places where you want the view updated. see ccl.northwestern.edu/netlogo/docs/dictionary.html#display

      – Seth Tisue
      Jan 9 at 15:51



















    Can you elaborate more on your suggestion, please?

    – Javier Sandoval
    Jan 8 at 4:10





    Can you elaborate more on your suggestion, please?

    – Javier Sandoval
    Jan 8 at 4:10













    In what way? What seems unclear or incomplete?

    – Seth Tisue
    Jan 8 at 22:22





    In what way? What seems unclear or incomplete?

    – Seth Tisue
    Jan 8 at 22:22













    see also the doc at ccl.northwestern.edu/netlogo/docs/programming.html#view-updates which goes into this stuff fairly thoroughly

    – Seth Tisue
    Jan 8 at 22:32





    see also the doc at ccl.northwestern.edu/netlogo/docs/programming.html#view-updates which goes into this stuff fairly thoroughly

    – Seth Tisue
    Jan 8 at 22:32













    What is unclear is what you mean by saying "adding a call to display"

    – Javier Sandoval
    Jan 9 at 5:33





    What is unclear is what you mean by saying "adding a call to display"

    – Javier Sandoval
    Jan 9 at 5:33













    literally insert display in your code in places where you want the view updated. see ccl.northwestern.edu/netlogo/docs/dictionary.html#display

    – Seth Tisue
    Jan 9 at 15:51







    literally insert display in your code in places where you want the view updated. see ccl.northwestern.edu/netlogo/docs/dictionary.html#display

    – Seth Tisue
    Jan 9 at 15:51















    1














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






    share|improve this answer




























      1














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






      share|improve this answer


























        1












        1








        1







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






        share|improve this answer













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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 29 '18 at 19:22









        Javier SandovalJavier Sandoval

        15812




        15812






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53972374%2funexpected-paint-behavior%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas