[wxPython] CaptureMouse Problem

1 view
Skip to first unread message

Tyler foster

unread,
Jan 15, 2002, 12:56:06 AM1/15/02
to wxpytho...@lists.wxwindows.org

For some reason as soon as I get to " print 'captured' " the software stops responding. I can't figure it out If anyone could help I would really appreciate it.

        if event.LeftDown():
            print 'capturing'
            self.CaptureMouse()
            print 'captured'
            
        elif event.Dragging():
            print 'dragging'
            self.winPosition = self.GetPosition()   
            self.mousePosition = wxGetMousePosition()
            self.offsetx = self.mousePosition[0] - self.winPosition[0]
            self.offsety = self.mousePosition[1] - self.winPosition[1]
            print 'offset set'
            self.mousePosition = wxGetMousePosition()
            self.winPosition[0] = self.mousePosition[0] - self.offsetx
            self.winPosition[1] = self.mousePosition[1] - self.offsety
            print 'moving'
            self.Move(winPosition)
            print 'moved'

        elif event.LeftUp():
            print 'releasing'
            self.ReleaseMouse()      
            print 'released'

Tyler Foster



Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

Niki Spahiev

unread,
Jan 15, 2002, 2:35:04 AM1/15/02
to wxpytho...@lists.wxwindows.org
try this


elif event.Dragging():
print 'dragging'
self.winPosition = self.GetPosition()
self.mousePosition = wxGetMousePosition()

self.winPosition[0] = self.mousePosition[0]

self.winPosition[1] = self.mousePosition[1]

print 'moving'
self.Move(winPosition)
print 'moved'


Niki Spahiev


Tyler foster

unread,
Jan 15, 2002, 3:59:04 AM1/15/02
to wxpytho...@lists.wxwindows.org
I need it to move to an offset of mouse position - window position so that when they click on the button it doesnt jump the mouse off the button there for stoping the move.
 
_______________________________________________
wxpython-users mailing list
wxpytho...@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

Robin Dunn

unread,
Jan 15, 2002, 6:16:06 AM1/15/02
to wxpytho...@lists.wxwindows.org
[Please don't send HTML email to this list.]

> For some reason as soon as I get to " print 'captured' " the
> software stops responding. I can't figure it out If anyone
> could help I would really appreciate it.

Does it print "captured" or not? Please make a small (but complete) sample
that shows this problem.

--
Robin Dunn
Software Craftsman
ro...@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

Tyler foster

unread,
Jan 15, 2002, 8:43:03 AM1/15/02
to wxpytho...@lists.wxwindows.org

    def OnMoveLeftDown(self, event):


        if event.LeftDown():
            print 'capturing'
            self.CaptureMouse()

            print 'captured' <--It prints this then crashes
            
       
elif event.Dragging():


            print 'dragging'
            self.winPosition = self.GetPosition()   
            self.mousePosition = wxGetMousePosition()

            self.offsetx = self.mousePosition[0] - self.winPosition[0]
            self.offsety = self.mousePosition[1] - self.winPosition[1]
            print 'offset set'

            self.mousePosition = wxGetMousePosition()
            self.winPosition[0] = self.mousePosition[0] - self.offsety
            self.winPosition[1] = self.mousePosition[1] - self.offsetx
            print 'moving'
            self.Move(self.winPosition)
            print 'moved'

        elif event.LeftUp():
            print 'releasing'
            self.ReleaseMouse()      
            print 'released'

what I mean by "Crashes" Is completly freezes some times if I take the focus off the of the App and then focus back on it it unfreezes as long as I dont click on the button again.

Tyler

Tyler foster

unread,
Jan 15, 2002, 11:35:04 AM1/15/02
to wxpytho...@lists.wxwindows.org
Im useing Boa Constructor but I will try it.
 
----- Original Message -----
From: Dale Strickland-Clark
Sent: Tuesday, January 15, 2002 3:10 PM
Subject: RE: [wxPython] CaptureMouse Problem
 

Are you running this under PythonWin, by any chance?

 

If you are, try just running it from a command prompt.

 

Dale Strickland-Clark

Riverhall Systems Ltd. Custom database and Web  applications.

Offices: London & Wokingham

 

 

-----Original Message-----
From: Tyler foster [mailto:xmon...@msn.com]
Sent: Tue, 2002 January 15 21:40
To: wxpytho...@lists.wxwindows.org
Subject: Re: [wxPython] CaptureMouse Problem

 

    def OnMoveLeftDown(self, event):

<--It prints this then crashes
            
       
elif event.Dragging():

Dale Strickland-Clark

unread,
Jan 15, 2002, 10:07:04 AM1/15/02
to wxpytho...@lists.wxwindows.org
Reply all
Reply to author
Forward
0 new messages