简体   繁体   English

PyQT4和Ctrl C

[英]PyQT4 and Ctrl C

I have a programs that runs several threads (on a while loop until Ctrl C is pressed). 我有一个运行多个线程的程序(在while循环中,直到按Ctrl C为止)。 The app also has a GUI that I developed in PyQt. 该应用程序还具有我在PyQt中开发的GUI However, I am facing the following problem: 但是,我面临以下问题:

If I press Ctrl C on the console, and then close the GUI, the program exits fine. 如果我在控制台上按Ctrl C ,然后关闭GUI,则程序可以正常退出。 However, if I close the GUI first, the other threads won't stop and the program keeps running after Ctrl C . 但是,如果我先关闭GUI,其他线程将不会停止,并且在Ctrl C之后程序将继续运行。 Anyone knows how I could address this problem? 有人知道我该如何解决这个问题?

在Qt中,您将为小部件/框架重载OnClose方法,或挂接到lastwindowsdclosed信号以执行关闭应用程序所需的任何操作-不知道它是否与python不同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM