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)
add_click_button(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 get_id().

static get_class_type() TypeHandle
get_click_event(button: ButtonHandle) str

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

static get_click_prefix() 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().

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

is_button_down() bool

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

remove_click_button(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.get_text_node() will be used to create the label geometry. This automatically sets up the frame according to the size of the text.