[pygtk] More dialog closing issues - set_activates_default()

Rob Brown-Bayliss uncertain.genius at gmail.com
Sat Feb 3 13:09:02 WST 2007


Hi, I have a dialog as such:

	def new_location_dialog(self):
		t = None
		dialog = gtk.Dialog("New Location", self.main_window,
								gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
								(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
		dialog.vbox.pack_start(gtk.Label("Location's name"))
		entry = gtk.Entry()
		entry.set_activates_default(gtk.TRUE)
		print "----"
		print entry.get_activates_default()
		print "----"
		dialog.vbox.pack_start(entry)
		dialog.show_all()
		response = dialog.run()
		print response
		if response == gtk.RESPONSE_OK:
			t = entry.get_text().title()
		dialog.destroy()
		return t


Yet when I press enter in the entry the dialog does not close.
theprint between the lines dispalys True when run. How is the above
dialog broken and what should I do to get it to work?

Thanks
-- 
Rob


More information about the pygtk mailing list