Accessing Widget With GTK

Tony Corrente tonyc at
Thu Feb 8 11:00:58 CET 2001


I am very new to Python so please excuse me if this question is stupid
but I can't find an example anywhere.  I've created a form using Glade.
The form has a entry field name pName and a button.  I've run and
created the Python code. Everything worked..  glc created 2 files. the
main program and the window handler file for the button.  What I want to
know is... How do I update pName when the button is clicked? I've tried
just using
def on_bNext_clicked(widget, mainObj):
    pname.set_text("This is a test")
when I run the program and click the button I get the following error
Traceback (innermost last):
  File "/usr/lib/python1.5/site-packages/", line 125, in __call__
    ret = apply(self.func, a)
  File "", line 15, in on_bNext_clicked
    pName.set_text("This is a test")
NameError: pName

How do I access pName ( or any other widget in the window ) ???
Could anyone please guide me in the right direction ???

Thanks in advance...

More information about the Python-list mailing list