gtk.Editable — an interface for text-editing widgets.
class gtk.Editable(gobject.GInterface): |
"changed" | def callback( |
def callback( | |
def callback( |
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.
def select_region(start
, end
)
| the new start position of the selection |
| 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.
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.
def insert_text(text
, position
=0)
| the text to be inserted |
| the position where the text should be inserted |
The insert_text
() method inserts the
string specified by text
at the location specified by
position
.
def delete_text(start_pos
, end_pos
)
| the start position of the text to delete |
| 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.
def get_chars(start_pos
, end_pos
)
| the start position |
| 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.
def cut_clipboard()
The cut_clipboard
() method copies the
characters in the current selection to the clipboard and then deletes them
from the widget.
def copy_clipboard()
The copy_clipboard
() method copies the
characters in the current selection to the clipboard
def paste_clipboard()
The paste_clipboard
() method copies the
contents of the clipboard to the widget at the cursor position.
def delete_selection()
The delete_selection
() method deletes
the characters in the selection and releases the selection ownership
def set_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.
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.
def set_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.
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()
.
def callback(editable
, user_param1
, ...
)
| the editable that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "changed" signal is emitted when the contents of the widget have changed.
def callback(editable
, start
, end
, user_param1
, ...
)
| the editable that received the signal |
| the start position |
| the end position |
| the first user parameter (if any) specified
with the connect () |
| 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
()start
and end
parameters are
interpreted as for delete_text
()
def callback(editable
, new_text
, new_text_length
, position
, user_param1
, ...
)
| the editable that received the signal |
| the string that is being inserted |
| the length of the new text |
| a pointer to the location at which the new text will be inserted |
| the first user parameter (if any) specified
with the connect () |
| 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
()position
parameter is a gobject.GPointer
PyGTK
.