[snip]hello. i have been using th wonderul pygtk tutorial and have really enjoyed learning gui
My problem is that I cant seem to pass a text_entry afet I get it. Here is my program. What I want to do is be able to manipulate data that is entereed into a text_entry widget
Thank you for your help
self.printButton.connect("clicked", self.printIt, entry.get_text())
The problem is in this line. When you type 'entry.get_text()' is calls the get_text method immediately, so that what gets passed as to self.printButton.connect is actually an empty string (the current contents of the entry). What you need to do is pass the entry widget itself:
self.printButton.connect('clickec', self.printIt, entry)
And the inside 'printIt' call the get_text method. I have attached a fixed and cleaned up version of your code.
-- Tim Evans Applied Research Associates NZ http://www.aranz.com/
#!/usr/bin/python2.2 #This is the inital start # what is needed
import gtk class Application(object): def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_border_width(12) self.window.connect('destroy', self.quit) box2 = gtk.VBox(False, 0) box2.set_spacing(6) self.window.add(box2) self.button2 = gtk.Button("Quit") self.button2.connect("clicked",self.quit) box2.pack_start(self.button2, True, True, 0) entry = gtk.Entry(max=0) entry.show() box2.pack_start(entry, True, True, 0) self.printButton = gtk.Button("Print it?") self.printButton.connect("clicked", self.printIt, entry) box2.pack_start(self.printButton, True, True, 0) def printIt(self, button, entry): print "you typed: %r" % entry.get_text() def hello(self, widget, data=None): print "Hello" def quit(self, widget, data=None): gtk.main_quit() def main(self): self.window.show_all() gtk.main() if __name__ == '__main__': app = Application() app.main()
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/