gtk.EntryBuffer — stores text for display in a gtk.Entry
(new in PyGTK 2.22)
class gtk.EntryBuffer: |
|
def callback( | |
def callback( |
The gtk.EntryBuffer
class contains the actual text displayed in a
gtk.Entry
widget.
A single gtk.EntryBuffer
object can be shared by multiple
gtk.Entry
widgets which will then share the same text content, but not the cursor
position, visibility attributes, icon etc.
gtk.EntryBuffer
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.
gtk.EntryBuffer(initial_chars
, n_initial_chars
)
| initial buffer text, or None . |
| number of characters in initial_chars , or -1. |
Returns : | a new gtk.EntryBuffer . |
This constructor is available in PyGTK 2.22 and above.
Creates a new gtk.EntryBuffer
object.
def get_bytes()
Returns : | the byte length of the buffer. |
This method is available in PyGTK 2.22 and above.
The get_bytes
() method retrieves the length in bytes of the buffer.
See gtk.EntryBuffer.get_length
().
def get_length()
Returns : | the number of characters in the buffer. |
This method is available in PyGTK 2.22 and above.
The get_length
() method retrieves the length in characters of the buffer.
def set_text(chars
, n_chars
)
| the new text |
| the number of characters, or -1 |
This method is available in PyGTK 2.22 and above.
The set_text
() method sets the text in the buffer.
def get_text()
Returns : | the contents of the buffer. |
This method is available in PyGTK 2.22 and above.
The get_text
() method retrieves the contents of the buffer.
def set_max_length(max_length
)
| 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. |
This method is available in PyGTK 2.22 and above.
The set_max_length
() 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.
def get_max_length()
Returns : | the maximum allowed number of characters in the entry buffer, or 0 if there is no maximum. |
This method is available in PyGTK 2.22 and above.
The get_max_length
() method retrieves the maximum allowed length of the text in buffer.
See gtk.EntryBuffer.set_max_length
().
def insert_text(position
, chars
, n_chars
)
| the position at which to insert text. |
| the text to insert into the buffer. |
| the length of the text in characters, or -1. |
This method is available in PyGTK 2.22 and above.
The insert_text
() method inserts n_chars characters of chars into the contents of the buffer, at position position.
def delete_text(position
, n_chars
)
| the position at which to delete text. |
| the number of characters to delete. |
This method is available in PyGTK 2.22 and above.
The delete_text
() method 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. .
def emit_inserted_text(position
, chars
, n_chars
)
| the position at which text was inserted. |
| the text that was inserted. |
| the number of characters inserted. |
This method is available in PyGTK 2.22 and above.
The emit_inserted_text
() method can be used when subclassing
gtk.EntryBuffer
.
def emit_deleted_text(position
, n_chars
)
| the position at which text was deleted. |
| the number of characters deleted. |
This method is available in PyGTK 2.22 and above.
The emit_deleted_text
() method can be used when subclassing
gtk.EntryBuffer
.
def callback(buffer
, position
, n_chars
, user_param1
, ...
)
| the buffer that received the signal |
| the the position the text was deleted at |
| the number of characters that were deleted |
| the first user parameter (if any) specified with the connect () |
| additional user parameters (if any) |
The "activate" signal is emitted after text is deleted from the buffer.
def callback(buffer
, position
, chars
, n_chars
, user_param1
, ...
)
| the buffer that received the signal |
| the position the text was inserted at |
| the text that was inserted |
| the number of characters that were inserted |
| the first user parameter (if any) specified with the connect () |
| additional user parameters (if any) |
The "activate" signal is emitted after text is inserted into the buffer.