jarvisteach / appJar

Simple Tkinter GUIs in Python
http://appJar.info
Other
612 stars 68 forks source link

Keyboard shortcut not changing menu radio buttons #649

Open OIK2 opened 2 years ago

OIK2 commented 2 years ago

Bug Report


Context


I am creating a submenu of menu radio buttons with a for loop, including shortcuts. The menu works, but the shortcuts do not.

Expected Behaviour


For the submenu to show a list of menu radio buttons numbered 0-9, each with the shortcut Ctrl-#(0-9). They all activate the same function to change the number of places to display after a decimal point.

Actual Behaviour


They show up correctly, display the shortcut correctly, and work when clicked, but nothing seems to happen when the shortcut is used.

Any error messages produced by appJar


No errors produced.

Sample code, demonstrating the issue


def fpChange(name):
    global this
    this['fp'] = app.getMenuRadioButton("Max Digits After Decimal",name)
    conv()
    pass
app.addSubMenu("View","Max Digits After Decimal")
for i in range(10):
    app.addMenuRadioButton("Max Digits After Decimal","fp",i,fpChange,shortcut=f"Control-{i}")

What steps are needed to reproduce the bug


Attempt to use the keyboard shortcut to try to change the selected menu radio button.

Version Information


appJar: 0.94.0 Python: 3.10.4 TCL: 8.6, TK: 8.6 Platform: Linux pid: 11798 locale: en_US

OIK2 commented 2 years ago

I did more testing... I checked if it was a problem of using numbers with shortcut keys, still did it with letters(and other shortcuts work in the program).

Checked if it was using the f-string, not the problem.

Checked if it was the loop, not it, still did it when I turned the 2 lines into 10 with hard coded values.

The only thing that I see is the menu radio buttons and shortcuts. I have shortcuts on menu items and menu check boxes, but these are the only menu radio buttons that I have use shortcuts.