如何重启PyQt4应用程序 [英] How to Restart PyQt4 Application
本文介绍了如何重启PyQt4应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以重新启动PyQt应用程序QApplication
Is there a way to restart PyQt application QApplication
我有一个使用以下代码使用pyqt4和python 2.6创建的应用
I have an app created with pyqt4 and python 2.6 using below code
app = QtGui.QApplication(sys.argv)
我有一些设置选项,可以在其中进行一些设置.现在,当我保存设置时,我需要重新加载应用程序,以便新设置生效.无需最终用户退出并再次启动应用程序.
i have settings options where i set some settings. Now when i save settings i need to reload the application so that new settings are effected. Without the need of end user to exit and launch the app again.
推荐答案
我有一个类似的问题,只是在适当的地方使用了它:
I had a similar problem and simply used this at the appropriate place:
subprocess.Popen([__file__])
sys.exit(0)
这是一个简单的应用程序,不需要任何其他参数.
It was a simple application, and didn't need any further arguments.
这篇关于如何重启PyQt4应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文