PGButton

from panda3d.core import PGButton
class PGButton

Bases:

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

enum State
enumerator S_ready = 0
enumerator S_depressed = 1
enumerator S_rollover = 2
enumerator S_inactive = 3
__init__(name: str)
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.

property click_prefix string

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 getId().

static getClassType() TypeHandle
getClickEvent(button: ButtonHandle) str

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

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 getId().

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.

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.

setup(ready: NodePath)

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

setup(ready: NodePath, depressed: NodePath)

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

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

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

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

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

setup(label: str, bevel: float)

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.