jdf / processing-py-site

Site for processing.py.
MIT License
197 stars 52 forks source link

displayWidth not defined ? #187

Closed jxlotthe closed 3 years ago

jxlotthe commented 3 years ago

I used the following code in Python Mode: size(displayWidth, displayHeight) and get the following error : NameError: global name 'displayWidth' is not defined

I thought displayWidth and displayHeight were system variables that did not need to be defined...

jdf commented 3 years ago

Could you please post a small, complete example program that demonstrates the error?

jxlotthe commented 3 years ago

Hi Jonathan here is the simplest code example that fails: def setup(): size(displayWidth, displayHeight) line(0, 0, width, height)

The code is taken from the Processing.py reference

jdf commented 3 years ago

As of Processing 3, to run a sketch at the full dimensions of a screen, use the fullScreen() function, rather than the older way of using size(displayWidth, displayHeight).

tabreturn commented 3 years ago

@jdf What should be done about these entries?

The example code is misleading. Maybe just a print(displayWidth, displayHeight) line instead? Or maybe:

def setup():
    fullScreen()
    line(0, 0, displayWidth, displayHeight)