Re: pygnome and GnomeDialog.button_connect() problems




I found out that I can use dialog.connect("clicked", self.dialog_clicked_cb)
instead, and also that there is a better place for questions like these:
the pygtk@daa.com.au mailing-list.

Quoting Andreas Persenius (ndap@swipnet.se):
> Could anyone tell me why the code at the bottom doesn't work.
> 
> If I click on the Cancel button I get:
> Traceback (innermost last):
>   File "/usr/lib/python1.5/site-packages/gtk.py", line 448, in show_all
>     _gtk.gtk_widget_show_all(self._o)
> AttributeError: _o
> 
> If I click on the Ok button I get.
> TypeError: unbound method must be called with class instance 1st argument
> 
> ..and if I click Cancel, Ok and Ok it dumps core.
> 
> <--- CUT HERE --->
> #!/usr/bin/env python
> import gtk
> from gnome.ui import *
> 
> class TestGnomeDialog:
> 	def __init__(self):
> 		dialog = GnomeDialog('The Title', STOCK_BUTTON_OK, STOCK_BUTTON_CANCEL)
> 		dialog.button_connect(0, self.ok_button_cb)
> 		dialog.button_connect(1, self.cancel_button_cb)
> 		dialog.show_all()
> 	def ok_button_cb(self, widget, obj=None):
> 		print "OK button was clicked."
> 	def cancel_button_cb(self, widget, obj=None):
> 		print "Cancel button was clicked."
> 	
> aWindow = TestGnomeDialog()
> gtk.mainloop()
> <--- CUT HERE --->
> 
> -- 
> Andreas Persenius |
> ndap@swipnet.se   | http://home.swipnet.se/darshiva/
> ----------------------------------------------------

-- 
Andreas Persenius |
ndap@swipnet.se   | http://home.swipnet.se/darshiva/
----------------------------------------------------



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