So I need to be able to open several images in a grid layout and click on the images to perform various actions. Right now I am adding the images to a grid sizer. How do I capture mouse events from a sizer? Or should I display the images in another way to make it easy to respond to mouse events?
A:
Bind one of the mouse events to your images
eg.
your_staticBitmap_object.bind(wx.EVT_LEFT_UP, self.onImageClick, your_staticBitmap_object)
volting
2010-08-04 19:07:46
What should the type of your_image_object be here? Would it be wx.Image or wx.StaticBitmap or something else?
Johnny
2010-08-04 20:03:43
Bind it your wx.StaticBitmap...
volting
2010-08-04 20:21:24
Great thanks it works. The problem now is I don't know how to determine which Image triggered the event in the handler- GetEventSource returns the parent frame, not the image.
Johnny
2010-08-04 21:06:55
Easy, just call GetId() on the event in the handler and compare it to the ID's of your staticBitmaps. If you want an example let me know and Ill add it to the my answer.
volting
2010-08-04 23:27:11
and dont forget you can vote up my answer if your happy with it, which I assume are since you accepted it :P
volting
2010-08-04 23:27:42