gtk.EntryBuffer

gtk.EntryBuffer — stores text for display in a gtk.Entry (new in PyGTK 2.22)

Synopsis

class gtk.EntryBuffer:
    gtk.EntryBuffer(initial_chars, n_initial_chars)

def get_bytes()

def get_length()

def set_text(chars, n_chars)

def get_text()

def set_max_length(max_length)

def get_max_length()

def insert_text(position, chars, n_chars)

def delete_text(position, n_chars)

def emit_inserted_text(position, chars, n_chars)

def emit_deleted_text(position, n_chars)

Ancestry

+-- gobject.GObject
  +-- gtk.EntryBuffer

gtk.EntryBuffer Properties

"length"ReadThe length (in characters) of the text in buffer. Allowed values: <=65535. Default value: 0.
"max-length"Read/WriteThe maximum length (in characters) of the text in the buffer. Allowed values: <=65535. Default value: 0.
"text"Read/WriteThe contents of the buffer. Default value: "".

gtk.EntryBuffer Signal Prototypes

gobject.GObject Signal Prototypes

"deleted-text"

def callback(buffer, position, n_chars, user_param1, ...)

"inserted-text"

def callback(buffer, position, chars, n_chars, user_param1, ...)

Description

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.

Constructor

    gtk.EntryBuffer(initial_chars, n_initial_chars)

initial_chars :

initial buffer text, or None.

n_initial_chars :

number of characters in initial_chars, or -1.

Returns :

a new gtk.EntryBuffer.

Note

This constructor is available in PyGTK 2.22 and above.

Creates a new gtk.EntryBuffer object.

Methods

gtk.EntryBuffer.get_bytes

    def get_bytes()

Returns :

the byte length of the buffer.

Note

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

gtk.EntryBuffer.get_length

    def get_length()

Returns :

the number of characters in the buffer.

Note

This method is available in PyGTK 2.22 and above.

The get_length() method retrieves the length in characters of the buffer.

gtk.EntryBuffer.set_text

    def set_text(chars, n_chars)

chars :

the new text

n_chars :

the number of characters, or -1

Note

This method is available in PyGTK 2.22 and above.

The set_text() method sets the text in the buffer.

gtk.EntryBuffer.get_text

    def get_text()

Returns :

the contents of the buffer.

Note

This method is available in PyGTK 2.22 and above.

The get_text() method retrieves the contents of the buffer.

gtk.EntryBuffer.set_max_length

    def set_max_length(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.

Note

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.

gtk.EntryBuffer.get_max_length

    def get_max_length()

Returns :

the maximum allowed number of characters in the entry buffer, or 0 if there is no maximum.

Note

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

gtk.EntryBuffer.insert_text

    def insert_text(position, chars, n_chars)

position :

the position at which to insert text.

chars :

the text to insert into the buffer.

n_chars :

the length of the text in characters, or -1.

Note

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.

gtk.EntryBuffer.delete_text

    def delete_text(position, n_chars)

position :

the position at which to delete text.

n_chars :

the number of characters to delete.

Note

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. .

gtk.EntryBuffer.emit_inserted_text

    def emit_inserted_text(position, chars, n_chars)

position :

the position at which text was inserted.

chars :

the text that was inserted.

n_chars :

the number of characters inserted.

Note

This method is available in PyGTK 2.22 and above.

The emit_inserted_text() method can be used when subclassing gtk.EntryBuffer.

gtk.EntryBuffer.emit_deleted_text

    def emit_deleted_text(position, n_chars)

position :

the position at which text was deleted.

n_chars :

the number of characters deleted.

Note

This method is available in PyGTK 2.22 and above.

The emit_deleted_text() method can be used when subclassing gtk.EntryBuffer.

Signals

The "deleted-text" gtk.EntryBuffer Signal

    def callback(buffer, position, n_chars, user_param1, ...)

buffer :

the buffer that received the signal

position :

the the position the text was deleted at

n_chars :

the number of characters that were deleted

user_param1 :

the first user parameter (if any) specified with the connect() method

... :

additional user parameters (if any)

The "activate" signal is emitted after text is deleted from the buffer.

The "inserted-text" gtk.EntryBuffer Signal

    def callback(buffer, position, chars, n_chars, user_param1, ...)

buffer :

the buffer that received the signal

position :

the position the text was inserted at

chars :

the text that was inserted

n_chars :

the number of characters that were inserted

user_param1 :

the first user parameter (if any) specified with the connect() method

... :

additional user parameters (if any)

The "activate" signal is emitted after text is inserted into the buffer.