class documentation

class Window:

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method key_pressed Return True if the given key is currently pressed. If no key given, then returns True if any key is pressed.
Method mouse_down Undocumented
Async Method next_frame Yields control until the next frame is drawn.
Method reset_timer Undocumented
Method run Undocumented
Method set_background_color Undocumented
Method set_debug Undocumented
Method set_fullscreen Undocumented
Method set_size No summary
Method set_stage Undocumented
Method set_title Undocumented
Constant FPS Undocumented
Constant FRAME_SEC Undocumented
Property actual_fps @return the actual calculated FPS as a float. This is usually slightly less than the configured fps() due to overhead. But if you see it drop, you may be having a performance problem or taking too much time in the event callbacks.
Property fps The target Frames Per Second used for calculations.
Property mouse_pointer @return the position of the mouse pointer as an (x,y) tuple.
Property mouse_x Undocumented
Property mouse_y Undocumented
Property random_position Pick a random position within the window and return it as an (x,y) pair. @return a tuple of an (x,y) coordinate
Property rect Undocumented
Property size @return the (w,h) size of the window as a tuple
Property stage Undocumented
Property timer Like the Scratch 'timer' pseudo-variable, this will return the number of seconds (and fractional seconds) since the program was started.
Method _async_tick Undocumented
Method _handleEvents Undocumented
Method _make_screen Undocumented
Instance Variable _backgroundColor Undocumented
Instance Variable _debug Undocumented
Instance Variable _epoch Undocumented
Instance Variable _frameDraw Undocumented
Instance Variable _fullScreen Undocumented
Instance Variable _lastDraw Undocumented
Instance Variable _mouseDown Undocumented
Instance Variable _mousePos Undocumented
Instance Variable _rollingFrameSec Undocumented
Instance Variable _running Undocumented
Instance Variable _stage Undocumented
Instance Variable _windowSize Undocumented
def __init__(self):

Undocumented

def key_pressed(self, key=None):

Return True if the given key is currently pressed. If no key given, then returns True if any key is pressed.

Parameters
keyCan be the text name of the key. Some examples are 'a', '3', 'space', 'up', 'down', 'left', 'right', etc. The complete list of names is determined by the pygame.key module. Key can also be a pygame.K_* integer constant.
def mouse_down(self):

Undocumented

async def next_frame(self):

Yields control until the next frame is drawn.

def reset_timer(self):

Undocumented

def run(self):

Undocumented

def set_background_color(self, color: pygame.color.Color):

Undocumented

def set_debug(self, val=True):

Undocumented

def set_fullscreen(self):

Undocumented

def set_size(self, width, height):
def set_stage(self, newStage):

Undocumented

def set_title(self, title):

Undocumented

FPS: int =

Undocumented

Value
30
FRAME_SEC =

Undocumented

Value
1/FPS
@property
actual_fps: float =

@return the actual calculated FPS as a float. This is usually slightly less than the configured fps() due to overhead. But if you see it drop, you may be having a performance problem or taking too much time in the event callbacks.

@property
fps: int =

The target Frames Per Second used for calculations.

@property
mouse_pointer =

@return the position of the mouse pointer as an (x,y) tuple.

@property
mouse_x =

Undocumented

@property
mouse_y =

Undocumented

@property
random_position =

Pick a random position within the window and return it as an (x,y) pair. @return a tuple of an (x,y) coordinate

@property
rect =

Undocumented

@property
size =

@return the (w,h) size of the window as a tuple

@property
stage =

Undocumented

@property
timer =

Like the Scratch 'timer' pseudo-variable, this will return the number of seconds (and fractional seconds) since the program was started.

def _async_tick(self, screen):

Undocumented

def _handleEvents(self):

Undocumented

def _make_screen(self, windowSize):

Undocumented

_backgroundColor =

Undocumented

_debug =

Undocumented

_epoch =

Undocumented

_frameDraw =

Undocumented

_fullScreen: bool =

Undocumented

_lastDraw =

Undocumented

_mouseDown: bool =

Undocumented

_mousePos: tuple[int, ...] =

Undocumented

_rollingFrameSec =

Undocumented

_running: bool =

Undocumented

_stage =

Undocumented

_windowSize =

Undocumented