PGEntry
from panda3d.core import PGEntry
- class PGEntry
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
- SFocus = 0
- SInactive = 2
- SNoFocus = 1
- S_focus = 0
- S_inactive = 2
- S_no_focus = 1
- __init__(*args, **kwargs)
- accept_failed_prefix = 'acceptfailed-'
- accept_prefix = 'accept-'
- active
Returns whether the PGItem is currently active for mouse events. See set_active().
- blink_rate
- candidate_active
- candidate_inactive
- clearCursorDef()
C++ Interface: clear_cursor_def(const PGEntry self)
- /**
Removes all the children from the cursor_def node, in preparation for
adding a new definition.
*/
- clear_cursor_def()
C++ Interface: clear_cursor_def(const PGEntry self)
- /**
Removes all the children from the cursor_def node, in preparation for
adding a new definition.
*/
- cursor_def
- cursor_keys_active
- cursor_position
- cursormove_prefix = 'cursormove-'
- erase_prefix = 'erase-'
- focus
Returns whether the PGItem currently has focus for keyboard events. See set_focus().
- getAcceptEvent()
C++ Interface: get_accept_event(PGEntry self, const ButtonHandle button)
- /**
Returns the event name that will be thrown when the entry is accepted
normally.
*/
- getAcceptFailedEvent()
C++ Interface: get_accept_failed_event(PGEntry self, const ButtonHandle button)
- /**
Returns the event name that will be thrown when the entry cannot accept an
input
*/
- getAcceptFailedPrefix()
C++ Interface: get_accept_failed_prefix()
- /**
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().
*/
- getAcceptPrefix()
C++ Interface: get_accept_prefix()
- /**
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().
*/
- getBlinkRate()
C++ Interface: get_blink_rate(PGEntry self)
- /**
Returns the number of times per second the cursor will blink, or 0 if the
cursor is not to blink.
*/
- getCandidateActive()
C++ Interface: get_candidate_active(PGEntry self)
- /**
See set_candidate_active().
*/
- getCandidateInactive()
C++ Interface: get_candidate_inactive(PGEntry self)
- /**
See set_candidate_inactive().
*/
- getCharacter()
C++ Interface: get_character(PGEntry self, int n)
- /**
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
*/
- getClassType()
C++ Interface: get_class_type()
- getCursorDef()
C++ Interface: get_cursor_def(const PGEntry self)
- /**
Returns the Node that will be rendered to represent the cursor. You can
attach suitable cursor geometry to this node.
*/
- getCursorKeysActive()
C++ Interface: get_cursor_keys_active(PGEntry self)
- /**
Returns whether the arrow keys are currently set to control movement of the
cursor; see set_cursor_keys_active().
*/
- getCursorPosition()
C++ Interface: get_cursor_position(PGEntry self)
- /**
Returns the current position of the cursor.
*/
- getCursorX()
C++ Interface: get_cursor_X(PGEntry self)
- /**
Returns the node position x of the cursor
*/
- getCursorY()
C++ Interface: get_cursor_Y(PGEntry self)
- /**
Returns the node position y of the cursor
*/
- getCursormoveEvent()
C++ Interface: get_cursormove_event(PGEntry self)
- /**
Returns the event name that will be thrown whenever the cursor moves
*/
- getCursormovePrefix()
C++ Interface: get_cursormove_prefix()
- /**
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().
*/
- getEraseEvent()
C++ Interface: get_erase_event(PGEntry self)
- /**
Returns the event name that will be thrown whenever the user erases
characters in the text.
*/
- getErasePrefix()
C++ Interface: get_erase_prefix()
- /**
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().
*/
- getGraphic()
C++ Interface: get_graphic(PGEntry self, int n)
- /**
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.
*/
- getMaxChars()
C++ Interface: get_max_chars(PGEntry self)
- /**
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().
*/
- getMaxWidth()
C++ Interface: get_max_width(PGEntry self)
- /**
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().
*/
- getNumCharacters()
C++ Interface: get_num_characters(PGEntry self)
- /**
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().
*/
- getNumLines()
C++ Interface: get_num_lines(PGEntry self)
- /**
Returns the number of lines of text the PGEntry will use, if _max_width is
not 0. See set_num_lines().
*/
- getObscureMode()
C++ Interface: get_obscure_mode(PGEntry self)
- /**
Specifies whether obscure mode is enabled. See set_obscure_mode().
*/
- getOverflowEvent()
C++ Interface: get_overflow_event(PGEntry self)
- /**
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().
*/
- getOverflowMode()
C++ Interface: get_overflow_mode(PGEntry self)
- /**
Specifies whether overflow mode is enabled. See set_overflow_mode().
*/
- getOverflowPrefix()
C++ Interface: get_overflow_prefix()
- /**
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().
*/
- getPlainText()
C++ Interface: get_plain_text(PGEntry self)
- /**
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().
*/
- getPlainWtext()
C++ Interface: get_plain_wtext(PGEntry self)
- /**
Returns the text currently displayed within the entry, without any embedded
properties characters.
*/
- getProperties()
C++ Interface: get_properties(PGEntry self, int n)
- /**
Returns the TextProperties in effect for the object at the indicated
position in the pre-wordwrapped string.
*/
- getText()
C++ Interface: get_text(PGEntry self)
- /**
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().
*/
- getTextDef()
C++ Interface: get_text_def(PGEntry self, int state)
- /**
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().
*/
- getTypeEvent()
C++ Interface: get_type_event(PGEntry self)
- /**
Returns the event name that will be thrown whenever the user extends the
text by typing.
*/
- getTypePrefix()
C++ Interface: get_type_prefix()
- /**
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().
*/
- getWtext()
C++ Interface: get_wtext(PGEntry self)
- /**
Returns the text currently displayed within the entry.
*/
- get_accept_event()
C++ Interface: get_accept_event(PGEntry self, const ButtonHandle button)
- /**
Returns the event name that will be thrown when the entry is accepted
normally.
*/
- get_accept_failed_event()
C++ Interface: get_accept_failed_event(PGEntry self, const ButtonHandle button)
- /**
Returns the event name that will be thrown when the entry cannot accept an
input
*/
- get_accept_failed_prefix()
C++ Interface: get_accept_failed_prefix()
- /**
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().
*/
- get_accept_prefix()
C++ Interface: get_accept_prefix()
- /**
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().
*/
- get_blink_rate()
C++ Interface: get_blink_rate(PGEntry self)
- /**
Returns the number of times per second the cursor will blink, or 0 if the
cursor is not to blink.
*/
- get_candidate_active()
C++ Interface: get_candidate_active(PGEntry self)
- /**
See set_candidate_active().
*/
- get_candidate_inactive()
C++ Interface: get_candidate_inactive(PGEntry self)
- /**
See set_candidate_inactive().
*/
- get_character()
C++ Interface: get_character(PGEntry self, int n)
- /**
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
*/
- get_class_type()
C++ Interface: get_class_type()
- get_cursor_X()
C++ Interface: get_cursor_X(PGEntry self)
- /**
Returns the node position x of the cursor
*/
- get_cursor_Y()
C++ Interface: get_cursor_Y(PGEntry self)
- /**
Returns the node position y of the cursor
*/
- get_cursor_def()
C++ Interface: get_cursor_def(const PGEntry self)
- /**
Returns the Node that will be rendered to represent the cursor. You can
attach suitable cursor geometry to this node.
*/
- get_cursor_keys_active()
C++ Interface: get_cursor_keys_active(PGEntry self)
- /**
Returns whether the arrow keys are currently set to control movement of the
cursor; see set_cursor_keys_active().
*/
- get_cursor_position()
C++ Interface: get_cursor_position(PGEntry self)
- /**
Returns the current position of the cursor.
*/
- get_cursormove_event()
C++ Interface: get_cursormove_event(PGEntry self)
- /**
Returns the event name that will be thrown whenever the cursor moves
*/
- get_cursormove_prefix()
C++ Interface: get_cursormove_prefix()
- /**
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()
C++ Interface: get_erase_event(PGEntry self)
- /**
Returns the event name that will be thrown whenever the user erases
characters in the text.
*/
- get_erase_prefix()
C++ Interface: get_erase_prefix()
- /**
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()
C++ Interface: get_graphic(PGEntry self, int n)
- /**
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()
C++ Interface: get_max_chars(PGEntry self)
- /**
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()
C++ Interface: get_max_width(PGEntry self)
- /**
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()
C++ Interface: get_num_characters(PGEntry self)
- /**
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()
C++ Interface: get_num_lines(PGEntry self)
- /**
Returns the number of lines of text the PGEntry will use, if _max_width is
not 0. See set_num_lines().
*/
- get_obscure_mode()
C++ Interface: get_obscure_mode(PGEntry self)
- /**
Specifies whether obscure mode is enabled. See set_obscure_mode().
*/
- get_overflow_event()
C++ Interface: get_overflow_event(PGEntry self)
- /**
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()
C++ Interface: get_overflow_mode(PGEntry self)
- /**
Specifies whether overflow mode is enabled. See set_overflow_mode().
*/
- get_overflow_prefix()
C++ Interface: get_overflow_prefix()
- /**
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()
C++ Interface: get_plain_text(PGEntry self)
- /**
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()
C++ Interface: get_plain_wtext(PGEntry self)
- /**
Returns the text currently displayed within the entry, without any embedded
properties characters.
*/
- get_properties()
C++ Interface: get_properties(PGEntry self, int n)
- /**
Returns the TextProperties in effect for the object at the indicated
position in the pre-wordwrapped string.
*/
- get_text()
C++ Interface: get_text(PGEntry self)
- /**
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()
C++ Interface: get_text_def(PGEntry self, int state)
- /**
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()
C++ Interface: get_type_event(PGEntry self)
- /**
Returns the event name that will be thrown whenever the user extends the
text by typing.
*/
- get_type_prefix()
C++ Interface: get_type_prefix()
- /**
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()
C++ Interface: get_wtext(PGEntry self)
- /**
Returns the text currently displayed within the entry.
*/
- isWtext()
C++ Interface: is_wtext(PGEntry self)
- /**
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()).
*/
- is_wtext()
C++ Interface: is_wtext(PGEntry self)
- /**
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()).
*/
- max_chars
- max_width
- num_lines
- obscure_mode
- overflow_mode
- overflow_prefix = 'overflow-'
- setAcceptEnabled()
C++ Interface: set_accept_enabled(const PGEntry self, bool enabled)
- /**
Sets whether the input may be accepted–use to disable submission by the
user
*/
- setBlinkRate()
C++ Interface: set_blink_rate(const PGEntry self, float blink_rate)
- /**
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.
*/
- setCandidateActive()
C++ Interface: set_candidate_active(const PGEntry self, str candidate_active)
- /**
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.
*/
- setCandidateInactive()
C++ Interface: set_candidate_inactive(const PGEntry self, str candidate_inactive)
- /**
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.
*/
- setCursorKeysActive()
C++ Interface: set_cursor_keys_active(const PGEntry self, bool flag)
- /**
Sets whether the arrow keys (and home/end) control movement of the cursor.
If true, they are active; if false, they are ignored.
*/
- setCursorPosition()
C++ Interface: set_cursor_position(const PGEntry self, int position)
- /**
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.
*/
- setMaxChars()
C++ Interface: set_max_chars(const PGEntry self, int max_chars)
- /**
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.
*/
- setMaxWidth()
C++ Interface: set_max_width(const PGEntry self, float max_width)
- /**
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).
*/
- setNumLines()
C++ Interface: set_num_lines(const PGEntry self, int num_lines)
- /**
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.
*/
- setObscureMode()
C++ Interface: set_obscure_mode(const PGEntry self, bool flag)
- /**
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.
*/
- setOverflowMode()
C++ Interface: set_overflow_mode(const PGEntry self, bool flag)
- /**
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.
*/
- setText()
C++ Interface: set_text(const PGEntry self, str text)
- /**
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.).
*/
- setTextDef()
C++ Interface: set_text_def(const PGEntry self, int state, TextNode node)
- /**
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().
*/
- setWtext()
C++ Interface: set_wtext(const PGEntry self, unicode wtext)
- /**
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.).
*/
- set_accept_enabled()
C++ Interface: set_accept_enabled(const PGEntry self, bool enabled)
- /**
Sets whether the input may be accepted–use to disable submission by the
user
*/
- set_blink_rate()
C++ Interface: set_blink_rate(const PGEntry self, float blink_rate)
- /**
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()
C++ Interface: set_candidate_active(const PGEntry self, str candidate_active)
- /**
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()
C++ Interface: set_candidate_inactive(const PGEntry self, str candidate_inactive)
- /**
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()
C++ Interface: set_cursor_keys_active(const PGEntry self, bool flag)
- /**
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()
C++ Interface: set_cursor_position(const PGEntry self, int position)
- /**
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()
C++ Interface: set_max_chars(const PGEntry self, int max_chars)
- /**
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()
C++ Interface: set_max_width(const PGEntry self, float max_width)
- /**
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()
C++ Interface: set_num_lines(const PGEntry self, int num_lines)
- /**
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()
C++ Interface: set_obscure_mode(const PGEntry self, bool flag)
- /**
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()
C++ Interface: set_overflow_mode(const PGEntry self, bool flag)
- /**
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()
C++ Interface: set_text(const PGEntry self, str text)
- /**
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()
C++ Interface: set_text_def(const PGEntry self, int state, TextNode node)
- /**
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()
C++ Interface: set_wtext(const PGEntry self, unicode wtext)
- /**
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()
C++ Interface: setup(const PGEntry self, float width, int num_lines)
- /**
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.
*/
- setupMinimal()
C++ Interface: setup_minimal(const PGEntry self, float width, int num_lines)
- /**
Sets up the entry without creating any frame or other decoration.
*/
- setup_minimal()
C++ Interface: setup_minimal(const PGEntry self, float width, int num_lines)
- /**
Sets up the entry without creating any frame or other decoration.
*/
- type_prefix = 'type-'