ethanhs / pyhooked

Pure Python hotkey hook, with thanks to pyHook and pyhk
155 stars 28 forks source link

About unhook opportunity #27

Closed dkzone000 closed 7 years ago

dkzone000 commented 7 years ago

Dear ethanhs ,

First , thanks to provide this project .

I have use Console to open the example you provide name "example_gui.py" , then if I close the UI , the project still work . It's mean the threading is not close ?

Thanks

ethanhs commented 7 years ago

Hi @dkzone000, I'm glad you like it! Please be aware that I am not going to support this for much longer (see #25). To answer your question, yes, the thread works separately from the GUI (otherwise it can cause other problems). If you want to exit with the window, you probably want to add the kwarg daemon=True to your creation of Thread, so that it will end with your GUI. so it would be threading.Thread(target=hk.hook, daemon=True) I hope this answers your question.

dkzone000 commented 7 years ago

Hi @ethanhs ,

Sorry to post this issue , I found this is python's mechanism , then , I will try dameon or subprocess , I think its can solve my problem.

Thanks.

ethanhs commented 7 years ago

No problem. daemon should definitely do what you need.