debugging some old glade.XML code, not getting a return of text?



Hello everybody,

I am debugging a piece of old python gtk code and found that the bellow ask function using glade.XML to ask a question does not seem to return the insert string entered into the generated dialog.

How can I change the bellow code to return the insert text string?

Kind regards,

Jelle de Jong


def ask(question, parent=None):
dia = glade.XML(terp_path('terp.glade'), 'win_quest', gettext.textdomain())
        win = dia.get_widget('win_quest')
        label = dia.get_widget('label')
        label.set_text(question)
        entry = dia.get_widget('entry')

        if not parent:
                parent=service.LocalService('gui.main').window
        win.set_transient_for(parent)
        win.set_icon(TINYERP_ICON)

        response = win.run()
        print response
        parent.present()
        win.destroy()

        #jelledj
        name = entry.get_text()
        print name
        print "testing"

        if response == gtk.RESPONSE_CANCEL:
                return None
        else:
                return entry.get_text()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]