How to get or set the text of a textfield?
gordon at panix.com
Sun Jul 10 23:44:44 EDT 2011
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?
I don't know anything about Glade, so I can't answer your question
definitively. However, as a general rule, you can use the dir() builtin
function to see what methods are defined by an object.
So, assuming you have access to an interactive shell within your Glade
environment, you can do this:
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.
John Gordon A is for Amy, who fell down the stairs
gordon at panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
More information about the Python-list