panda3d.core.PGButton

from panda3d.core import PGButton
class PGButton

Bases: PGItem

This is a particular kind of PGItem that is specialized to behave like a normal button object. It keeps track of its own state, and handles mouse events sensibly.

Inheritance diagram

Inheritance diagram of PGButton

__init__(name: str) → None
setup(ready: NodePath) → None

Sets up the button using the indicated NodePath as arbitrary geometry.

setup(ready: NodePath, depressed: NodePath) → None

Sets up the button using the indicated NodePath as arbitrary geometry.

setup(ready: NodePath, depressed: NodePath, rollover: NodePath) → None

Sets up the button using the indicated NodePath as arbitrary geometry.

setup(ready: NodePath, depressed: NodePath, rollover: NodePath, inactive: NodePath) → None

Sets up the button using the indicated NodePath as arbitrary geometry.

setup(label: str, bevel: float) → None

Sets up the button as a default text button using the indicated label string. The TextNode defined by PGItem.getTextNode() will be used to create the label geometry. This automatically sets up the frame according to the size of the text.

addClickButton(button: ButtonHandle) → bool

Adds the indicated button to the set of buttons that can effectively “click” the PGButton. Normally, this is just MouseButton.one(). Returns true if the button was added, or false if it was already there.

removeClickButton(button: ButtonHandle) → bool

Removes the indicated button from the set of buttons that can effectively “click” the PGButton. Normally, this is just MouseButton.one(). Returns true if the button was removed, or false if it was not in the set.

hasClickButton(button: ButtonHandle) → bool

Returns true if the indicated button is on the set of buttons that can effectively “click” the PGButton. Normally, this is just MouseButton.one().

isButtonDown() → bool

Returns true if the user is currently holding the mouse button down on the button, false otherwise.

static getClickPrefix() → str

Returns the prefix that is used to define the click event for all PGButtons. The click event is the concatenation of this string followed by get_id().

getClickEvent(button: ButtonHandle) → str

Returns the event name that will be thrown when the button is clicked normally.

static getClassType() → TypeHandle
Return type

TypeHandle

property click_prefix

Returns the prefix that is used to define the click event for all PGButtons. The click event is the concatenation of this string followed by get_id().

Return type

string

enum State
enumerator S_ready = 0
enumerator S_depressed = 1
enumerator S_rollover = 2
enumerator S_inactive = 3