Dec-29-2020, 07:49 PM
Hi,
In a class I use the code below to print in the console if the Caps Lock is on or not.
Instead of printing, I'd like to compare the e.state and if it's =="Caps Lock" then dispaly a msg:
messagebox.showinfo ( "Warning" , "Caps Lock is activated")
How do I do that?
TIA
In a class I use the code below to print in the console if the Caps Lock is on or not.
Instead of printing, I'd like to compare the e.state and if it's =="Caps Lock" then dispaly a msg:
messagebox.showinfo ( "Warning" , "Caps Lock is activated")
How do I do that?
TIA
mods = { 0x0001: 'Shift', 0x0002: 'Caps Lock', 0x0004: 'Control', 0x0008: 'Left-hand Alt', 0x0010: 'Num Lock', 0x0080: 'Right-hand Alt', 0x0100: 'Mouse button 1', 0x0200: 'Mouse button 2', 0x0400: 'Mouse button 3' } self.username.bind('<Key>', lambda e: print('Mods:', mods.get( e.state, None )))