Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8066039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:51:19+00:00 2026-06-05T11:51:19+00:00

I’m debugging a user experience bug in a PyGTK program (although the question will

  • 0

I’m debugging a user experience bug in a PyGTK program (although the question will probably be applicable to GTK as well), and suddenly realized that the bug is ‘triggered’ depending on the user executing the program.

I reduced the issue 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 box as myself, I get this dialog:

Are you sure to quit?
    <Yes>   No

When I run this on my box 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 GTK-related hidden directory in my homedir, so I can’t understand where is that preference coming from.

Before someone suggest md.set_default_response(), that’s not exactly what I want. I tried to set md.set_default_response(gtk.RESPONSE_YES) after creating the dialog, and yes, the ‘Yes’ button gets selected, but still the ‘No’ is printed on the left.

I’d like to understand where this behavior comes from, and try to fix it once for all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:51:20+00:00Added an answer on June 5, 2026 at 11:51 am

    Looking at the GTK+ C sources I finally found the answer.

    It seems that the GNOME Human Interface Guidelines advocate the use of the affirmative button at the far right, but in platforms like Windows, the standard is affirmative first, so in widgets that have to deal with buttons you have a function called set_alternative_button_order() that rearrange the buttons in case a global setting called gtk-alternative-button-order is set to 1.

    Then the second part of the answer is that KDE tries to mimic Windows. Knowing what I had to look for, I found another gtkrc-2.0 inside KDE, in /home/myuser/.kde/share/config/gtkrc-2.0:gtk-alternative-button-order = 1, in order to make the GTK applications running under KDE as similar as possible to the non-GTK ones.

    That’s why root had a different behavior, because I never ran KDE as root in my system and it had no such setting in the .kde/ directory.

    The moral of the story is that you must set the default button in this type of dialogs, no matter what you get, or otherwise GTK will default to the first one, and this will lead to inconsistent behavior. In my case, in plain GTK the default answer for quitting the program was not to do it, but in Windows or KDE it was to exit.

    I hope it’s clear and this helps any programmer that has the same problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.