newbie Q: mouse clicks don't seem to get trapped

mitsura at skynet.be mitsura at skynet.be
Mon Sep 5 09:12:19 EDT 2005


Hi,

I want to display a window containing an image and when I move the
mouse over the image and click on the left Mb, I want to get the
position of the mouse on the image.
I listed the code to view the image below (so far so good) but for some
reason the EVT_LEFT_DOWN/UP does not work.

Any idea what might be wrong?

With kind regards,

Kris



"
class DisplayPicture(wx.Frame):
      cD = 0
      # bmp = stream that contains the picture (not a filename!)
      # w,h: widht, height of the picture
      def __init__(self, parent, id, title, bmp, w, h):
    	 wxFrame.__init__(self,parent,wxID_ANY, title, size = ( w, h),
                                    style=wxDEFAULT_FRAME_STYLE)


         self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftClick)
         self.Bind(wx.EVT_LEFT_UP, self.OnLeftClick)

         Panel=wx.Panel(self)
         wx.StaticBitmap(Panel, -1, bmp, (5, 5) )

         self.Show()
         
      def OnLeftClick(self, event):
      	  print "ok"     
"




More information about the Python-list mailing list