The Screen is the base object for any pyDraw program, and can perform a variety of different tasks.
Quick Reference can help with simple issues or give you a basic understanding of the methods available, but it can never replace full documentation which is available here.
Initialization
You can initialize a Screen by passing a width and height (in pixels), and you can also pass an optional title. The default title is: "pydraw".
You can initiate a prompt to collect user input simply:
Mouse Location
You can retrieve the mouse's current (or last known) location like so:
Screen Capture
It is possible to capture the contents of the Screen and write it to a specified image file:
Updating and Clearing
You can update/clear the screen as expected:
Reset
You can reset the screen, which removes all objects and input hooks:
Sleeping and Delay
The Screen has the ability to delay the program by a specified amount in seconds, but will also calculate a deltaTime in order to keep program execution delays as consistent as possible:
This method can only be used while within a while loop, if you want to normally delay a program, you should call:
Removing Objects
Although a method exists on all objects to remove themselves, the Screen is also able to remove objects from itself:
Objects List
You can retrieve a list of all active objects (not including grid and helpers):
Check if an Object Exists
You can check if an object is on the screen:
Grids and Helpers
Screens have a fairly advanced grid system, allowing you to specify the number of rows or columns, or optionally the size of each cell (the default size of the cells will be 50x50):
You can also activate helper-labels for coordinates like so (every 100 pixels):
Be careful when creating or destroying grids, as it is a somewhat intensive process.