How to get or set the text of a textfield?

Adam Tauno Williams awilliam at whitemice.org
Mon Jul 11 06:24:53 EDT 2011


On Mon, 2011-07-11 at 03:44 +0000, John Gordon wrote:
> In <mailman.877.1310350451.1164.python-list at python.org> Anthony Papillion <papillion at gmail.com> writes:
> > So I've built a UI with Glade and have loaded it using the standard
> > Python code. In my UI, I have a textfield called txtUsername. How do I
> > get and set the text in this field from my Python code?

field.get_text()
field.set_text(value)

<http://pygtk.org/docs/pygtk/class-gtkentry.html#method-gtkentry--set-text>

> and it will print a list of methods that are defined by that object.
> Hopefully one of them will be called something helpful like set_text()
> or set_property().  Once you know the method name, you might try a Google
> search to determine the exact usage and arguments.

-1 -1 -1  Do not "google" [search the Internet] for solutions to pyGtk
problems.  That is just a confusing waste of time.  Use the *excellent*
and well-linked documentation:

<http://pygtk.org/docs/pygtk/>
<http://faq.pygtk.org/index.py?req=index>

The FAQ is extensive and really does cover a lot of the common
questions.  Also there is a list specifically for pygtk questions:

<http://www.daa.com.au/mailman/listinfo/pygtk>

Google, or Bing, or even DuckDuckGo, are *not* your friends.  They are
enormous and inefficient time-sinks.  They are a *BAD* way to solve
problems.  Use the documentation.




More information about the Python-list mailing list