PGEntry

from panda3d.core import PGEntry
class PGEntry

Bases:

Bases: PGItem

This is a particular kind of PGItem that handles simple one-line or short multi-line text entries, of the sort where the user can type any string.

A PGEntry does all of its internal manipulation on a wide string, so it can store the full Unicode character set. The interface can support either the wide string getters and setters, or the normal 8-bit string getters and setters, which use whatever encoding method is specified by the associated TextNode.

Inheritance diagram

Inheritance diagram of PGEntry

enum State
enumerator S_focus = 0
enumerator S_no_focus = 1
enumerator S_inactive = 2
__init__(name: str)
clear_cursor_def()

Removes all the children from the cursor_def node, in preparation for adding a new definition.

get_accept_event(button: ButtonHandle) str

Returns the event name that will be thrown when the entry is accepted normally.

get_accept_failed_event(button: ButtonHandle) str

Returns the event name that will be thrown when the entry cannot accept an input

static get_accept_failed_prefix() str

Returns the prefix that is used to define the accept failed event for all PGEntries. This event is the concatenation of this string followed by get_id().

static get_accept_prefix() str

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

Returns the number of times per second the cursor will blink, or 0 if the cursor is not to blink.

get_candidate_active() str

See set_candidate_active().

get_candidate_inactive() str

See set_candidate_inactive().

get_character(n: int) int

Returns the character at the indicated position in the entry. If the object at this position is a graphic object instead of a character, returns 0.

static get_class_type() TypeHandle
get_cursor_X() float
get_cursor_Y() float
get_cursor_def() NodePath

Returns the Node that will be rendered to represent the cursor. You can attach suitable cursor geometry to this node.

get_cursor_keys_active() bool

Returns whether the arrow keys are currently set to control movement of the cursor; see set_cursor_keys_active().

get_cursor_position() int

Returns the current position of the cursor.

get_cursormove_event() str

Returns the event name that will be thrown whenever the cursor moves

static get_cursormove_prefix() str

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

get_erase_event() str

Returns the event name that will be thrown whenever the user erases characters in the text.

static get_erase_prefix() str

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

get_graphic(n: int) TextGraphic

Returns the graphic object at the indicated position in the pre-wordwrapped string. If the object at this position is a character instead of a graphic object, returns NULL.

get_max_chars() int

Returns the current maximum number of characters that may be typed into the entry, or 0 if there is no limit. See set_max_chars().

get_max_width() float

Returns the current maximum width of the characters that may be typed into the entry, or 0 if there is no limit. See set_max_width().

get_num_characters() int

Returns the number of characters of text in the entry. This is the actual number of visible characters, not counting implicit newlines due to wordwrapping, or formatted characters for text properties changes. If there is an embedded TextGraphic object, it counts as one character.

This is also the length of the string returned by get_plain_text().

get_num_lines() int

Returns the number of lines of text the PGEntry will use, if _max_width is not 0. See set_num_lines().

get_obscure_mode() bool

Specifies whether obscure mode is enabled. See set_obscure_mode().

get_overflow_event() str

Returns the event name that will be thrown when too much text is attempted to be entered into the PGEntry, exceeding either the limit set via set_max_chars() or via set_max_width().

get_overflow_mode() bool

Specifies whether overflow mode is enabled. See set_overflow_mode().

static get_overflow_prefix() str

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

get_plain_text() str

Returns the text currently displayed within the entry, without any embedded properties characters.

This uses the Unicode encoding currently specified for the “focus” TextNode; therefore, the TextNode must exist before calling get_text().

get_plain_wtext() str

Returns the text currently displayed within the entry, without any embedded properties characters.

get_properties(n: int) TextProperties

Returns the TextProperties in effect for the object at the indicated position in the pre-wordwrapped string.

get_text() str

Returns the text currently displayed within the entry. This uses the Unicode encoding currently specified for the “focus” TextNode; therefore, the TextNode must exist before calling get_text().

get_text_def(state: int) TextNode

Returns the TextNode that will be used to render the text within the entry when the entry is in the indicated state. See set_text_def().

get_type_event() str

Returns the event name that will be thrown whenever the user extends the text by typing.

static get_type_prefix() str

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

get_wtext() str

Returns the text currently displayed within the entry.

is_wtext() bool

Returns true if any of the characters in the string returned by get_wtext() are out of the range of an ASCII character (and, therefore, get_wtext() should be called in preference to get_text()).

set_accept_enabled(enabled: bool)

Sets whether the input may be accepted–use to disable submission by the user

Sets the number of times per second the cursor will blink while the entry has keyboard focus.

If this is 0, the cursor does not blink, but is held steady.

set_candidate_active(candidate_active: str)

Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages. Each candidate string represents one possible way to interpret the sequence of keys the user has just entered; it should not be considered typed yet, but it is important for the user to be able to see what he is considering entering.

This particular method sets the properties for the subset of the current candidate string that the user can actively scroll through.

set_candidate_inactive(candidate_inactive: str)

Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages. Each candidate string represents one possible way to interpret the sequence of keys the user has just entered; it should not be considered typed yet, but it is important for the user to be able to see what he is considering entering.

This particular method sets the properties for the subset of the current candidate string that the user is not actively scrolling through.

set_cursor_keys_active(flag: bool)

Sets whether the arrow keys (and home/end) control movement of the cursor. If true, they are active; if false, they are ignored.

set_cursor_position(position: int)

Sets the current position of the cursor. This is the position within the text at which the next letter typed by the user will be inserted; normally it is the same as the length of the text.

set_max_chars(max_chars: int)

Sets the maximum number of characters that may be typed into the entry. This is a limit on the number of characters, as opposed to the width of the entry; see also set_max_width().

If this is 0, there is no limit.

set_max_width(max_width: float)

Sets the maximum width of all characters that may be typed into the entry. This is a limit on the width of the formatted text, not a fixed limit on the number of characters; also set_max_chars().

If this is 0, there is no limit.

If _num_lines is more than 1, rather than being a fixed width on the whole entry, this becomes instead the wordwrap width (and the width limit on the entry is essentially _max_width * _num_lines).

set_num_lines(num_lines: int)

Sets the number of lines of text the PGEntry will use. This only has meaning if _max_width is not 0; _max_width indicates the wordwrap width of each line.

set_obscure_mode(flag: bool)

Specifies whether obscure mode should be enabled. In obscure mode, a string of asterisks is displayed instead of the literal text, e.g. for entering passwords.

In obscure mode, the width of the text is computed based on the width of the string of asterisks, not on the width of the actual text. This has implications on the maximum length of text that may be entered if max_width is in effect.

set_overflow_mode(flag: bool)

Specifies whether overflow mode should be enabled. In overflow mode, text can overflow the boundaries of the Entry element horizontally.

Overflow mode only works when the number of lines is 1.

set_text(text: str) bool

Changes the text currently displayed within the entry. This uses the Unicode encoding currently specified for the “focus” TextNode; therefore, the TextNode must exist before calling set_text().

The return value is true if all the text is accepted, or false if some was truncated (see set_max_width(), etc.).

set_text_def(state: int, node: TextNode)

Changes the TextNode that will be used to render the text within the entry when the entry is in the indicated state. The default if nothing is specified is the same TextNode returned by PGItem.get_text_node().

set_wtext(wtext: str) bool

Changes the text currently displayed within the entry.

The return value is true if all the text is accepted, or false if some was truncated (see set_max_width(), etc.).

setup(width: float, num_lines: int)

Sets up the entry for normal use. The width is the maximum width of characters that will be typed, and num_lines is the integer number of lines of text of the entry. Both of these together determine the size of the entry, based on the TextNode in effect.

setup_minimal(width: float, num_lines: int)

Sets up the entry without creating any frame or other decoration.