window_move()#

Set the Sketch’s window location.

Examples#

1py5.run_sketch(block=False)
2# move the sketch window to the upper left corner of the display
3py5.window_move(0, 0)
 1# this sketch will hide itself and reappear elsewhere on your display.
 2def setup():
 3    global surface
 4    global visible
 5    surface = py5.get_surface()
 6    visible = True
 7
 8
 9def draw():
10    global visible
11    if py5.frame_count % 250 == 0:
12        # this negates the visible variable
13        visible = not visible
14        if visible:
15            py5.window_move(py5.random_int(py5.display_width),
16                            py5.random_int(py5.display_height))
17        surface.set_visible(visible)

Description#

Set the Sketch’s window location. Calling this repeatedly from the draw() function may result in a sluggish Sketch. Negative or invalid coordinates are ignored. To hide a Sketch window, use Py5Surface.set_visible().

Underlying Processing method: windowMove

Syntax#

window_move(x: int, y: int, /) -> None

Parameters#

  • x: int - x-coordinate for window location

  • y: int - y-coordinate for window location

Updated on February 21, 2022 11:40:40am UTC