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 3279900
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:38:40+00:00 2026-05-17T19:38:40+00:00

I have a messageDialog set up so that its default response is gtk.RESPONSE_OK so

  • 0

I have a messageDialog set up so that its default response is gtk.RESPONSE_OK so the okay button is clicked when the user hits enter even if the okay button does not have focus. I would like to also have the space bar trigget the default_response. What is the best way to do this?

This is with python 2.4 in a linux environment. Unfortunately I don’t have permission to upgrade python.

  • 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-05-17T19:38:41+00:00Added an answer on May 17, 2026 at 7:38 pm

    Connect to the key-press-event signal on the message dialog:

    def on_dialog_key_press(dialog, event):
        if event.string == ' ':
            dialog.response(gtk.RESPONSE_OK)
            return True
        return False
    
    dialog = gtk.MessageDialog(message_format='Some message', buttons=gtk.BUTTONS_OK_CANCEL)
    dialog.add_events(gtk.gdk.KEY_PRESS_MASK)
    dialog.connect('key-press-event', on_dialog_key_press)
    dialog.run()
    

    Bear in mind, though, that changing users’ expectations of the user interface is generally considered Not Cool.

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

Sidebar

Related Questions

I am using MVC 3 and I have a button that the user presses
I have a function that creates prompts using gtk.MessageDialog in PyGTK. How could I
I want to show a jquery dialog next to a button when its clicked.
I have a glade GUI and i'm using dome gtk.MessageDialog widgets created with pygtk
I'm writing a tool that suppose to have GTK gui and operate with windows
I have a stored procedure that adds a user and at each permission I
I have an RCP Application where upen delete, MessageDialog is used for confirming the
Below is the plugin code that i have tried to reuse from an old
i have a dialog box and in it, it has two buttons, one that
I have a simple java GUI application, which will prompt a user for a

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.