Gtk.EntryBuffer¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
|||
r/w/en |
|||
r/w |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The text is altered in the default handler for this signal. |
|
This signal is emitted after text is inserted into the buffer. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gtk.EntryBuffer(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A
GtkEntryBuffer
hold the text displayed in aGtkText
widget.A single
GtkEntryBuffer
object can be shared by multiple widgets which will then share the same text content, but not the cursor position, visibility attributes, icon etc.GtkEntryBuffer
may be derived from. Such a derived class might allow text to be stored in an alternate location, such as non-pageable memory, useful in the case of important passwords. Or a derived class could integrate with an application’s concept of undo/redo.- classmethod new(initial_chars, n_initial_chars)[source]¶
- Parameters:
- Returns:
A new
GtkEntryBuffer
object.- Return type:
Create a new
GtkEntryBuffer
object.Optionally, specify initial text to set in the buffer.
- delete_text(position, n_chars)[source]¶
- Parameters:
- Returns:
The number of characters deleted.
- Return type:
Deletes a sequence of characters from the buffer.
n_chars characters are deleted starting at position. If n_chars is negative, then all characters until the end of the text are deleted.
If position or n_chars are out of bounds, then they are coerced to sane values.
Note that the positions are specified in characters, not bytes.
- emit_inserted_text(position, chars, n_chars)[source]¶
- Parameters:
Used when subclassing
GtkEntryBuffer
.
- get_bytes()[source]¶
- Returns:
The byte length of the buffer.
- Return type:
Retrieves the length in bytes of the buffer.
See [method`Gtk`.EntryBuffer.get_length].
- get_length()[source]¶
- Returns:
The number of characters in the buffer.
- Return type:
Retrieves the length in characters of the buffer.
- get_max_length()[source]¶
- Returns:
the maximum allowed number of characters in
GtkEntryBuffer
, or 0 if there is no maximum.- Return type:
Retrieves the maximum allowed length of the text in self.
- get_text()[source]¶
- Returns:
a pointer to the contents of the widget as a string. This string points to internally allocated storage in the buffer and must not be freed, modified or stored.
- Return type:
Retrieves the contents of the buffer.
The memory pointer returned by this call will not change unless this object emits a signal, or is finalized.
- insert_text(position, chars, n_chars)[source]¶
- Parameters:
- Returns:
The number of characters actually inserted.
- Return type:
Inserts n_chars characters of chars into the contents of the buffer, at position position.
If n_chars is negative, then characters from chars will be inserted until a null-terminator is found. If position or n_chars are out of bounds, or the maximum buffer text length is exceeded, then they are coerced to sane values.
Note that the position and length are in characters, not in bytes.
- set_max_length(max_length)[source]¶
- Parameters:
max_length (
int
) – the maximum length of the entry buffer, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.
Sets the maximum allowed length of the contents of the buffer.
If the current contents are longer than the given length, then they will be truncated to fit.
- set_text(chars, n_chars)[source]¶
-
Sets the text in the buffer.
This is roughly equivalent to calling [method`Gtk`.EntryBuffer.delete_text] and [method`Gtk`.EntryBuffer.insert_text].
Note that n_chars is in characters, not in bytes.
- do_delete_text(position, n_chars) virtual¶
- Parameters:
- Returns:
The number of characters deleted.
- Return type:
Deletes a sequence of characters from the buffer.
n_chars characters are deleted starting at position. If n_chars is negative, then all characters until the end of the text are deleted.
If position or n_chars are out of bounds, then they are coerced to sane values.
Note that the positions are specified in characters, not bytes.
- do_get_length() virtual¶
- Returns:
The number of characters in the buffer.
- Return type:
Retrieves the length in characters of the buffer.
- do_insert_text(position, chars, n_chars) virtual¶
- Parameters:
- Returns:
The number of characters actually inserted.
- Return type:
Inserts n_chars characters of chars into the contents of the buffer, at position position.
If n_chars is negative, then characters from chars will be inserted until a null-terminator is found. If position or n_chars are out of bounds, or the maximum buffer text length is exceeded, then they are coerced to sane values.
Note that the position and length are in characters, not in bytes.
Signal Details¶
- Gtk.EntryBuffer.signals.deleted_text(entry_buffer, position, n_chars)¶
- Signal Name:
deleted-text
- Flags:
- Parameters:
entry_buffer (
Gtk.EntryBuffer
) – The object which received the signalposition (
int
) – the position the text was deleted at.n_chars (
int
) – The number of characters that were deleted.
The text is altered in the default handler for this signal.
If you want access to the text after the text has been modified, use
GObject.ConnectFlags.AFTER
.
- Gtk.EntryBuffer.signals.inserted_text(entry_buffer, position, chars, n_chars)¶
- Signal Name:
inserted-text
- Flags:
- Parameters:
entry_buffer (
Gtk.EntryBuffer
) – The object which received the signalposition (
int
) – the position the text was inserted at.chars (
str
) – The text that was inserted.n_chars (
int
) – The number of characters that were inserted.
This signal is emitted after text is inserted into the buffer.
Property Details¶
- Gtk.EntryBuffer.props.length¶
-
The length (in characters) of the text in buffer.
- Gtk.EntryBuffer.props.max_length¶
- Name:
max-length
- Type:
- Default Value:
0
- Flags:
The maximum length (in characters) of the text in the buffer.