Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (29 sloc) 1.67 KB
Entry
=====
Entry widgets allow the user to enter text. You can change the contents with the
:meth:`Gtk.Entry.set_text` method, and read the current contents with the
:meth:`Gtk.Entry.get_text` method. You can also limit the number of characters
the Entry can take by calling :meth:`Gtk.Entry.set_max_length`.
Occasionally you might want to make an Entry widget read-only. This can be done
by passing ``False`` to the :meth:`Gtk.Entry.set_editable` method.
Entry widgets can also be used to retrieve passwords from the user. It is common
practice to hide the characters typed into the entry to prevent revealing the
password to a third party. Calling :meth:`Gtk.Entry.set_visibility` with
``False`` will cause the text to be hidden.
:class:`Gtk.Entry` has the ability to display progress or activity information
behind the text. This is similar to :class:`Gtk.ProgressBar` widget and is
commonly found in web browsers to indicate how much of a page download has been
completed. To make an entry display such information, use
:meth:`Gtk.Entry.set_progress_fraction`, :meth:`Gtk.Entry.set_progress_pulse_step`,
or :meth:`Gtk.Entry.progress_pulse`.
Additionally, an Entry can show icons at either side of the entry. These icons
can be activatable by clicking, can be set up as drag source and can have tooltips.
To add an icon, use :meth:`Gtk.Entry.set_icon_from_icon_name`
or one of the various other functions that set an icon from an icon name, a pixbuf,
or icon theme. To set a tooltip on an icon, use
:meth:`Gtk.Entry.set_icon_tooltip_text` or the corresponding function for markup.
Example
-------
.. image:: ../images/entry_example.png
.. literalinclude:: ../examples/entry_example.py
:linenos:
You can’t perform that action at this time.