Width of the Py5Graphics drawing surface in pixels.
Width of the Py5Graphics drawing surface in pixels. When
pixel_density(2) was used in
settings() to make use of a high resolution display (called a Retina display on OSX or high-dpi on Windows and Linux), the width and height of the Py5Graphics drawing surface does not change, but the number of pixels is doubled. As a result, all operations that use pixels (like Py5Graphics.load_pixels(), Py5Graphics.get_pixels(), etc.) happen in this doubled space. As a convenience, the variables
pixel_width and Py5Graphics.pixel_height hold the actual width and height of the drawing surface in pixels. This is useful for any Py5Graphics objects that use the Py5Graphics.pixels or Py5Graphics.np_pixels arrays, for instance, because the number of elements in each array will be
This field is the same as pixel_width but linked to a
Py5Graphics object. To see example code for how it can be used, see pixel_width.
Underlying Processing field: PGraphics.pixelWidth
Updated on April 16, 2023 17:32:04pm UTC