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

  • Home
  • SEARCH
  • 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 6765361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:42:10+00:00 2026-05-26T14:42:10+00:00

I created a Gedit 2 plugin which adds an item to a menu as

  • 0

I created a Gedit 2 plugin which adds an item to a menu as described here. How could I bind a keyboard shortcut / accel key / accelerator key to this menu item?

  • 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-26T14:42:11+00:00Added an answer on May 26, 2026 at 2:42 pm

    Following the given tutorial, your plugin have some lines like the ones below somewhere:

    self._action_group = gtk.ActionGroup("ExamplePyPluginActions")
    self._action_group.add_actions([("ExamplePy", None, _("Clear document"),
             None, _("Clear the document"),
             self.on_clear_document_activate)])
    manager.insert_action_group(self._action_group, -1)
    

    Just replace the second None argument in

    self._action_group.add_actions([("ExamplePy", None, _("Clear document"),
            None, _("Clear the document"),
            self.on_clear_document_activate)])
    

    by your desired keyboard shortcut – let us say, ControlR:

    self._action_group.add_actions([("ExamplePy", None, _("Clear document"),
            "<control>r", _("Clear the document"), # <- here
            self.on_clear_document_activate)])
    

    You may have used a manually constructed action as well (this is at least my favorite way of working with it):

    action = gtk.Action("ExamplePy", 
            _("Clear document"), 
            _("Clear the document"), None)
    action.connect("activate", self.on_open_regex_dialog)
    action_group = gtk.ActionGroup("ExamplePyPluginActions")
    action_group.add_action(action)
    

    In this case, just replace action_group.add_action() by action_group.add_action_with_accel():

    action_group = gtk.ActionGroup("ExamplePyPluginActions")
    action_group.add_action_with_accel(action, "<control>r")
    

    (Asked and aswered by myself because of this and this; I lost some real time looking for it and I thought it will be a good reference.)

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

Sidebar

Related Questions

I am writing a Gedit plugin and created an icon for it as SVG
I created a program using dev-cpp and wxwidgets which solves a puzzle. The user
I created a few mediawiki custom tags, using the guide found here http://www.mediawiki.org/wiki/Manual:Tag_extensions I
I've a created an standalone application in which my aim is to execute a
i created an eventhandler system simplified described by following classes IEventType - containing string
I'm working on a Gedit plugin using Python (and PyGTK) and I really havent'
Created BroadcastReceiver which displays application name and version number on install/ uninstall of any
I created a cursor from the one that was described on this post: SQL
created an Eclipse plugin that contributes to the UI by a new project wizard
created a c# console project, which contains a console class (program.cs). i added 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.