How to set push-button to keyboard interrupt in PyQt
问题 While running program through the terminal we can stop the program by pressing 'Ctrl+c' and it will show the message as 'KeyboardInterrupt' . So, is there any way to do the sane thing by clicking the push-button in PyQt. 回答1: If your program is running a loop, you can call processEvents periodically to allow the gui time to update (which should allow you to click a button to close the application): count = 0 while True: count += 1 if not count % 50: QtGui.qApp.processEvents() # do stuff...