[pygtk] glitch in Dialog constructor?
Alfonso Tarantini
isit81 at fastwebnet.it
Wed Sep 12 21:39:52 WST 2007
Greetings everybody.
After deployment of gettext in my application, I encountered this runtime
error while creating a gtk.FileChooserDialog:
Traceback (most recent call last):
(...)
chooser = gtk.FileChooserDialog(_('Export to PNG...'), self,
gtk.FILE_CHOOSER_ACTION_SAVE, (_('_Select'), gtk.RESPONSE_OK,
gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
RuntimeError: first member of each text/response id pair must be a string
It turned out that the object returned by the installed gettext function _()
called like this:
_('_Select')
is actually an object of <type 'unicode'> and not of <type 'str'>.
The strange fact is that I can construct a gtk.Button with the 'unicode'
object as a label and the add_button(...) method in class gtk.Dialog works as
well:
chooser = gtk.FileChooserDialog(_('Export to PNG...'), self,
gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
select_label = _('_Select')
chooser.add_button(select_label, gtk.RESPONSE_OK)
(this works).
Is this a bug in PyGTK, GTK+, or not a bug at all?
Thank you,
Alfonso Tarantini
More information about the pygtk
mailing list