I’m trying to use the Control key to modify what happens when I click a button (which copies some info from a text control). However, it doesn’t appear to actually detect the status of the modifier keys at all.
Sample code:
def handleCopyUIDButton(self, evt):
evt.Skip()
uid = self.uid.GetValue()
if self.kbs.GetModifiers() == wx.MOD_CONTROL:
print("ctl on")
else:
print("ctl off")
I’m initializing the keyboard state class in the init of the panel that this method belongs to:
self.kbs = wx.KeyboardState()
The documentation is kind of skimpy on specifics so I expected it would be straightforward, but turns out, not so much.
I have tried a number of ways to get the state of the keys, including the above, using ControlDown() (which is advised against), and looking at the actual properties (which are always zero’d).
Probably a simple solution, but I’m not seeing it. Any hints?