I am debugging a user error in PyGTK (although the question is probably applicable to GTK as well), and I suddenly realized that the error is "triggered" depending on the user running the program.
I reduced the problem to a very simple script in PyGTK:
import gtk class PyApp(gtk.Window): def __init__(self): super(PyApp, self).__init__() self.set_size_request(250, 100) self.set_position(gtk.WIN_POS_CENTER) self.connect("destroy", gtk.main_quit) self.set_title("Message dialogs") ques = gtk.Button("Question") self.add(ques) ques.connect("clicked", self.on_ques) self.show_all() def on_ques(self, widget): md = gtk.MessageDialog(self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "Are you sure to quit?") md.run() md.destroy() PyApp() gtk.main()
When I run this on my inbox like me, I get this dialog:
Are you sure to quit? <Yes> No
When I run this in my inbox as root, I get this dialog:
Are you sure to quit? <No> Yes
Both users have the same .gtkrc-2.0 file, and I use KDE and don't have anything obvious hidden directory related to GTK in my homedir, so I can't figure out where this preference comes from.
Before anyone suggests md.set_default_response (), this is not quite what I want. I tried to set md.set_default_response (gtk.RESPONSE_YES) after creating the dialog, and yes, the "Yes" button will be selected, but still, "No" will be printed on the left.
I would like to understand where this comes from and try to fix it once for everyone.