SavinaRoja / PyUserInput

A module for cross-platform control of the mouse and keyboard in python that is simple to install and use.
GNU General Public License v3.0
1.07k stars 244 forks source link

Runtime Error #107

Open ipsBruno opened 6 years ago

ipsBruno commented 6 years ago

Hello ...

I have this code

class mouseevent(PyMouseEvent):
        def __init__(self):
            PyMouseEvent.__init__(self)

        def move(self, x, y):
            global lastKey 
            lastKey = time.time()

class keyevent(PyKeyboardEvent):
        def __init__(self):                      
            super(keyevent, self).__init__()
        def tap(self, keycode, character, press):
            global lastKey 
            lastKey = time.time()

keyHandlerThread = keyevent()
mouseHandlerThread = mouseevent()
keyHandlerThread.start()
mouseHandlerThread.run()

Works fine!

But on close application i get: Runtime Error: R6031

Apparently the threads are not killed. Someone with this problem?

Thanks in advance

mondeja commented 6 years ago

You should start and stop event threads with run() and stop() methods, or call thread.join() after start() method.