Print() function wants to print out the whole website

Whenever I have auto-refresh on and have written print() in draw then it wants to print out the websites like with ctrl + p and then when I try to close the tab I get a new one. I have lost code due to it.

I’m wondering if I can disable it.

Hi @n0x,

What do you expect by calling the print() in draw ?
Have you carefully studied the reference of print function ?

Note that calling print() without any arguments invokes the window.print() function which opens the browser’s print dialog. To print a blank line to console you can write print(‘\n’).

Cheers
— mnse

1 Like

Thanks, I expected nothing from calling print(). It’s easier to use auto-refresh and I’m usually not fast enough to write something into () so it would automatically invoke the window.print() and I wouldn’t be able to close the tab, thus losing my progress till last save. That’s why I would like to disable it.

Hello @n0x,

Replace print with console.log

Reference:
https://p5js.org/reference/#/console

I did not try it yet… you may want to explore this:

:)

Hi @n0x,

Ok! I think now I’ve understood what you mean. :slight_smile:

You mean on auto refresh, when you typing the print command it adds close bracket before you are able to type something in (), hence on the next draw iteration then opens the window.print dialogue… :slight_smile:

In this case I would recommend to use console.log instead of print … :slight_smile:

Cheers
— mnse