def __init__(self, parent, id=-1, title='', pos=wx.DefaultPosition, size=wx
    .DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name='frame'):
    wx.Frame.__init__(self, parent, id, title, pos, size, style, name)
self.panel = wx.ScrolledWindow(self, wx.ID_ANY)
self.panel.SetScrollbars(1, 1, 1, 1)
num = 4
cols = 3
rows = int(math.ceil(num / 3.0))
sizer = wx.GridSizer(rows=rows, cols=cols)
filenames = []
for i in range(num):
    filenames.append('img' + str(i) + '.png')
for imgid, fn in enumerate(filenames):
    img = wx.Image(fn, wx.BITMAP_TYPE_ANY)
img2 = wx.BitmapFromImage(img)
img3 = wx.StaticBitmap(self.panel, imgid, img2)
sizer.Add(img3)
img3.Bind(wx.EVT_LEFT_DCLICK, self.OnDClick)
self.panel.SetSizer(sizer)
self.Fit()

def OnDClick(self, event):
    print('you clicked img%s' % event.GetId())
wxPython: как определить источник события