manpagez: man pages & more
html files: pygtk
Home | html | info | man
): def select_region(start, end)
def get_selection_bounds()
def insert_text(text, position=0)
def delete_text(start_pos, end_pos)
def get_chars(start_pos, end_pos)
def cut_clipboard()
def copy_clipboard()
def paste_clipboard()
def delete_selection()
def set_position(position)
def get_position()
def set_editable(is_editable)
def get_editable()

gtk.Editable Signal Prototypes

"changed"

def callback(editable, user_param1, ...)

"delete-text"

def callback(editable, start, end, user_param1, ...)

"insert-text"

def callback(editable, new_text, new_text_length, position, user_param1, ...)

Description

gtk.Editable is an interface for text editing widgets, such as gtk.Entry. The editable class contains methods for generically manipulating an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of a widget.

Methods

gtk.Editable.select_region

    def select_region(start, end)

start :

the new start position of the selection

end :

the new end position of the selection

The select_region() method selects a region of text from start up to, but not including end. If end is negative, then the selection will run from start to the end of the text.

gtk.Editable.get_selection_bounds

    def get_selection_bounds()

Returns :

a tuple containing the start and end positions of the selection or an empty tuple if there is no selection

The get_selection_bounds() method returns a tuple that contains the start and end positions of the selection if any or an empty tuple if there is no selection.

gtk.Editable.insert_text

    def insert_text(text, position=0)

text :

the text to be inserted

position :

the position where the text should be inserted

The insert_text() method inserts the string specified by text at the location specified by position.

gtk.Editable.delete_text

    def delete_text(start_pos, end_pos)

start_pos :

the start position of the text to delete

end_pos :

the end position of the text to delete

The delete_text() method deletes a sequence of characters starting from start_pos up to, but not including end_pos. If end_pos is negative, then the characters deleted will be those characters from start_pos to the end of the text.

gtk.Editable.get_chars

    def get_chars(start_pos, end_pos)

start_pos :

the start position

end_pos :

the end position

Returns :

a string containing the characters from start to end

The get_chars() method retrieves a string of characters starting from start_pos up to, but not including end_pos. If end_pos is negative, then all the characters from start_pos to the end of the text are retrieved.

gtk.Editable.cut_clipboard

    def cut_clipboard()

The cut_clipboard() method copies the characters in the current selection to the clipboard and then deletes them from the widget.

gtk.Editable.copy_clipboard

    def copy_clipboard()

The copy_clipboard() method copies the characters in the current selection to the clipboard

gtk.Editable.paste_clipboard

    def paste_clipboard()

The paste_clipboard() method copies the contents of the clipboard to the widget at the cursor position.

gtk.Editable.delete_selection

    def delete_selection()

The delete_selection() method deletes the characters in the selection and releases the selection ownership

gtk.Editable.set_position

    def set_position(position)

position :

the new cursor position

The set_position() method sets the cursor position to be just before the character at the location specified by position. If position is less than 0 or greater than the number of characters in the widget the cursor is positioned after the last character in the widget. Note position is in characters not bytes.

gtk.Editable.get_position

    def get_position()

Returns :

the cursor position

The get_position() method retrieves the cursor position as a character index starting from 0. If the cursor is after the last character the position will equal the number of characters in the widget. Note position is in characters not bytes.

gtk.Editable.set_editable

    def set_editable(is_editable)

is_editable :

if True the text can be edited

The set_editable() method sets the widget "editable" attribute of the widget to the value specified by is_editable. If is_editable is True the text can be edited; if False, the text cannot be edited.

gtk.Editable.get_editable

    def get_editable()

Returns :

True if the text is editable.

The get_editable() method retrieves the value of the widget "editable" attribute that specifies whether the text is editable. See set_editable().

Signals

The "changed" gtk.Editable Signal

    def callback(editable, user_param1, ...)

editable :

the editable that received the signal

user_param1 :

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

... :

additional user parameters (if any)

The "changed" signal is emitted when the contents of the widget have changed.

The "delete-text" gtk.Editable Signal

    def callback(editable, start, end, user_param1, ...)

editable :

the editable that received the signal

start :

the start position

end :

the end position

user_param1 :

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

... :

additional user parameters (if any)

The "delete-text" signal is emitted when text is deleted from the widget by the user. The default handler for this signal will normally be responsible for deleting the text, so by connecting to this signal and then stopping the signal with the gobject.stop_emission() method, it is possible to prevent it from being deleted. The start and end parameters are interpreted as for delete_text()

The "insert-text" gtk.Editable Signal

    def callback(editable, new_text, new_text_length, position, user_param1, ...)

editable :

the editable that received the signal

new_text :

the string that is being inserted

new_text_length :

the length of the new text

position :

a pointer to the location at which the new text will be inserted

user_param1 :

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

... :

additional user parameters (if any)

The "insert-text" signal is emitted when text is inserted into the widget by the user. The default handler for this signal will normally be responsible for inserting the text, so by connecting to this signal and then stopping the signal with the gobject.stop_emission() method, it is possible to prevent it from being inserted entirely. The position parameter is a gobject.GPointer object containing a pointer to the insertion position - there is no way to access the position value from PyGTK.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.