How to run a function when user presses “X” in the Python Console?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to run a function when user presses “X” in the Python Console?



How do I run a function when user presses "X" button on the python running console?





Is the shutdown SIGKILLing your process? If so, there's nothing atexit can do. There's not even anything you could do in C code. SIGKILL can't be handled, blocked, or ignored; the kernel just kills the signalled process without running any further code.
– abarnert
15 mins ago


atexit


SIGKILL





Calling atexit.register() as the very last line in your program is kind of pointless - you might as well just call the registered function directly, since it's going to happen immediately anyway.
– jasonharper
14 mins ago


atexit.register()





Wait, that /s means this is Windows, not POSIX, right? The rules for what Windows does on shutdown are slightly different—but it comes down to TerminateProcess if you don't respond nicely, and you can't handle/ignore/block that either, so same deal.
– abarnert
13 mins ago


/s


TerminateProcess





os.system("shutdown /s /t 1") is working but it's not working when I'm calling it from register() func. And yes its windows
– crdw
9 mins ago





Ok, I think this question could be changed.
– crdw
5 mins ago









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived