Robins Gupta
Robins Gupta

Reputation: 3153

Wxpython: How to bind keyboard events of windows os directly with Application

I have designed a file copy software in python with GUI in Wxpython. Now I want to bind Windows standard keyboard event "CTRL+V" to my application so that when any user presses "CTRL+V" then my application automaticaly copies that file to it destination.

Upvotes: 0

Views: 223

Answers (1)

Joran Beasley
Joran Beasley

Reputation: 113930

use the Accelerator Table

def OnPaste(evt):
    pass #do something

pasteID = wx.NewId()
aTable = wx.AcceleratorTable([(wx.ACCEL_CTRL,  ord('V'), pasteID ),])
my_main_frame.SetAcceleratorTable(aTable)
my_main_frame.Bind(wx.EVT_MENU,OnPaste,pasteID )

Upvotes: 1

Related Questions