Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GTK does not accept special keys in shortcuts #2414

@RastislavKish

Description

@RastislavKish

Describe the bug

While the GTK backend can handle letter command shortcuts like Ctrl+L quite well, I'm unable to use Key.MOD_1+Key.SEMICOLON, Key.MOD_1+Key.PAGE_UP, Key.MOD_1+key.SPACE etc.

Steps to reproduce

  1. Run the Example Greeter app code below
  2. See the terminal output, Ctrl+; is also not visible in the Commands menu on the Greet command as a hint and can not be used to trigger the command.
(main.py:619420): Gtk-WARNING **: 20:31:22.372: Unable to parse accelerator '<Primary>;': ignored request to install 1 accelerators

(main.py:619420): Gtk-WARNING **: 20:31:22.408: Unable to parse accelerator '<Primary>;': ignored request to install 1 accelerators

Expected behavior

The shortcut should be registered properly and usable to activate its command, or, if this is not possible, the working / not working characters should be mentioned in the documentation.

Screenshots

No response

Environment

  • Operating System: Ubuntu Mate 22.04 64-bit
  • Python version: 3.10
  • Software versions:
    • Toga: 0.4.2

Logs


Additional context

The Greeter app code (a simple app that shows a greeting info_dialog upon activation of greet command:

import toga
from toga import Box, Command, Key

def greet(sender):
    app.main_window.info_dialog("Greeting", "Hello!",)

def build(app):
    app.commands.add(Command(greet,
        text="Greet",
        shortcut=Key.MOD_1+Key.SEMICOLON,
        ))

    return Box()

app=toga.App("Greeter", "com.example.greeter", startup=build)
app.main_loop()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions