Skip to content Skip to sidebar Skip to footer

WxPython Button Shortcut Accelerator How To '&spam'

How should I go about adding a button shortcut / accelerator? self.newItemButton = wx.Button(self.mainPanel, label='Scan &New Item') Doesn't seem to work on my platform. Pytho

Solution 1:

As @RobinDunn suggested it was a GTK configuration.

Basically change gtk-auto-mnemonics from 0 to 1.

Since I was using XFCE4, I enabled mnemonics in GTK2 for a specific theme like this:

enter image description here

#xfconf-query -c xsettings -p /Net/ThemeName

#grab the current style/theme name
VAR1=$(gconftool-2 --get /desktop/gnome/interface/gtk_theme)
# change to that theme directory
cd /usr/share/themes/$VAR1/gtk-2.0
# replace gtk-auto-mnemonics = 0 with 'gtk-auto-mnemonics=1# = 0'
sudo sed -i 's/gtk-auto-mnemonics/gtk-auto-mnemonics=1#/g' gtkrc
# change the theme to something else ... (Clearlooks, Ambiance, some_theme)
xfconf-query -c xsettings -p /Net/ThemeName -s Default
xfconf-query -c xsettings -p /Net/ThemeName -s $VAR1
#gconftool-2 --type=string -s /desktop/gnome/interface/gtk_theme ????

Although they work, by pressing alt its nice to know upfront without pressing extra buttons which of the 'ugly' buttons has accelerators.

Or in GTK3 change gtk-auto-mnemonics from 0 to 1 in:

/usr/share/themes/CURRENT_THEME_NAME/gtk-3.0/settings.ini

Results without having to press alt:

enter image description here


Post a Comment for "WxPython Button Shortcut Accelerator How To '&spam'"