from panda3d.core import VirtualMouse
class VirtualMouse

Bases: DataNode

Poses as a MouseAndKeyboard object in the datagraph, but accepts input from user calls, rather than reading the actual mouse and keyboard from an input device. The user can write high-level code to put the mouse wherever he/she wants, and to insert keypresses on demand.

Inheritance diagram

Inheritance diagram of VirtualMouse

__init__(param0: VirtualMouse) → None
__init__(name: str) → None
static getClassType() → TypeHandle
Return type


pressButton(button: ButtonHandle) → None

Simulates a mouse or keyboard button being depressed. This should be followed up by a call to releaseButton() sometime later (possibly immediately).

releaseButton(button: ButtonHandle) → None

Simulates the button being released. This should follow a previous call to pressButton().

setMouseOn(flag: bool) → None

Sets whether the mouse should appear to be within the window or not. If this is true, the mouse is within the window; if false, the mouse is not within the window (and setMousePos() means nothing).

setMousePos(x: int, y: int) → None

Sets the current mouse pixel location, where (0,0) is the upper left, and (width-1, height-1) is the lower right pixel of the virtual window.

setWindowSize(width: int, height: int) → None

Sets the size of the “window” in which the mouse rolls. This changes the meaning of the values passed to setMousePos().