Vizard 7 » Command Index » Vizard modules » viz » <viz:mouse>.getPosition
7.5

<viz:mouse>.getPosition

This command returns the current mouse position

<viz:mouse>.getPosition(  
mode = viz.WINDOW_NORMALIZED  
immediate = False  
)  
mode = viz.WINDOW_NORMALIZED
One of the following modes:

Mouse position modes

viz.WINDOW_NORMALIZED

Normalized (0,1) window coordinates relative to bottom left corner.

viz.WINDOW_PIXELS

Pixel coordinates relative to bottom left corner of window.

viz.SCREEN_PIXELS

Pixel coordinates relative to bottom left corner of monitor.

viz.RELATIVE_PIXELS

The relative movement of the mouse in pixels, since the last frame.

immediate = False
If True, Vizard will immediately query the mouse instead of using the cached value.

Remarks

This command can be called at any time to retrieve the current mouse position.

Return Value

[h, v] - A list containing the horizontal and vertical position of the mouse.

Example

pos = viz.mouse.getPosition()
print('mouse is currently at',pos)