{"id":10218,"date":"2010-08-01T15:28:34","date_gmt":"2010-08-01T07:28:34","guid":{"rendered":"http:\/\/ukyoi.wordpress.com\/?p=10218"},"modified":"2010-08-01T15:28:34","modified_gmt":"2010-08-01T07:28:34","slug":"%e7%bb%88%e4%ba%8e%e7%9f%a5%e9%81%93%e8%bf%99%e4%b8%aaapp-exec_%e6%98%af%e5%95%a5%e6%84%8f%e6%80%9d%e4%ba%86","status":"publish","type":"post","link":"https:\/\/ukyoi.info\/wordpress\/?p=10218","title":{"rendered":"\u7ec8\u4e8e\u77e5\u9053\u8fd9\u4e2aapp.exec_()\u662f\u5565\u610f\u601d\u4e86"},"content":{"rendered":"<p>\u79c1\u65e9\u5148\u5c31\u8bf4\u8fc7\uff0c\u79c1\u6bd4\u8f83\u4e60\u60ef\u81ea\u5df1\u5c1d\u8bd5\u3001\u7814\u7a76\uff0c\u662f\u5f88\u770b\u4e0d\u8fdb\u53c2\u8003\u4e66\u7684\u3002Python\u7684\u624b\u518c\u770b\u8fc7\u4e00\u90e8\u5206\uff0c\u540e\u6765\u53d1\u73b0\u5bf9\u79c1\u76f8\u5f53\u6666\u6da9\uff0c\u6240\u4ee5\u540e\u6765\u4e5f\u76f4\u63a5\u627e\u6559\u7a0b\uff0c\u4e0d\u600e\u4e48\u770b\u5b98\u65b9\u624b\u518c\u4e86\u3002<\/p>\n<p>PyQt\u7684\u624b\u518c\u770b\u5f97\u66f4\u5c11\u3002\u4e0d\u8fc7\u90a3\u5012\u4e0d\u662f\u56e0\u4e3a\u79c1\u6ca1\u5fc3\u601d\u770b\uff0c\u800c\u662f\u9762\u5bf9\u4e00\u5957\u65b0\u6982\u5ff5\u3001\u65b0\u540d\u8bcd\uff0c\u82f1\u8bed\u518d\u597d\u4e5f\u672a\u5fc5\u771f\u7684\u770b\u660e\u767d\uff0c\u4e8e\u662f\u627e\u5230\u4e86\u300aThe PyQt4 tutorial\u300b\u3002\u8fd9\u672c\u4e66\u867d\u7136\u4f8b\u5b50\u90fd\u5f88\u7b80\u6d01\uff0c\u4f46\u4f3c\u4e4e\u4e0d\u50cf\u662f\u4e3a\u56fe\u5f62\u7f16\u7a0b\u7684\u521d\u5b66\u8005\u5199\u7684\uff0c\u5bf9\u4e8e\u67d0\u4e9b\u57fa\u672c\u7684\u4e1c\u897f\u8bf4\u5f97\u975e\u5e38\u6a21\u7cca\uff0c\u6bd4\u5982\u8fd9\u6bb5\u5fc5\u52a0\u5185\u5bb9\uff1a<\/p>\n<p>app=QtGui.QApplication()<br \/>\n==\u82e5\u5e72\u4ee3\u7801\u2026\u2026==<br \/>\nsys.exit(app.exec_())<\/p>\n<p>\u7b2c\u4e00\u884c\u662f\u8bf4\u8981\u5efa\u7acb\u4e00\u4e2a\u201c\u5e94\u7528\u7a0b\u5e8f\u201d\uff0c\u867d\u7136\u79c1\u6ca1\u641e\u660e\u767d\u4e3a\u4ec0\u4e48\u5b83\u4e0d\u4f1a\u81ea\u52a8\u521b\u5efa\uff0c\u4e0d\u8fc7\u597d\u6b79\u7b97\u662f\u7406\u89e3\u4e86\u3002\u4f46\u6700\u540e\u4e00\u884c\u90a3\u4e2a\u5bf9app\u8fdb\u884c\u7684exec_()\u65b9\u6cd5\u5374\u600e\u4e48\u4e5f\u65e0\u6cd5\u7406\u89e3\u3002\u624b\u518c\u91cc\u5012\u662f\u89e3\u91ca\u4e86sys.exit()\uff0c\u8fd9\u672c\u6765\u662fPython\u7684\u65b9\u6cd5\uff0c\u8fd8\u4f1a\u6709\u4eba\u770b\u4e0d\u660e\u767d\u4e48\uff1f\u771f\u6b63\u8ba9\u4eba\u641e\u4e0d\u61c2\u7684\u662f\u90a3\u4e2aexec_()\uff0c\u800c\u8fd9\u672c\u6307\u5bfc\u5bf9\u6b64\u7684\u4f5c\u7528\u5219\u53ea\u5b57\u672a\u63d0\u3002\u5f53\u65f6\u79c1\u8fd8\u5bf9PyQt\u4e0d\u719f\u6089\uff0c\u90a3\u4e48\u591a\u7684\u7c7b\u90a3\u4e48\u591a\u7684\u51fd\u6570\u4e0e\u65b9\u6cd5\uff0c\u8fde\u624b\u518c\u90fd\u65e0\u4ece\u67e5\u8d77\uff0c\u53ea\u80fd\u7167\u846b\u82a6\u753b\u74e2\u5199\u3002<\/p>\n<p>\u540e\u6765\u7ec8\u4e8e\u662f\u7422\u78e8\u660e\u767d\u4e86\u3002\u8fd9\u4e2aapp\u4e0d\u662f\u4ec0\u4e48\u5185\u7f6e\u53d8\u91cf\uff0c\u800c\u662f\u4ee3\u7801\u7b2c\u4e00\u884c\u91cc\u9762\u4eba\u4e3a\u5b9a\u4e49\u7684\u4e00\u4e2aQApplication\u7684\u5b9e\u4f8b\uff0c\u4e5f\u5c31\u662f\u8bf4\u201capp\u201d\u8fd9\u4e2a\u540d\u5b57\u662f\u968f\u4fbf\u8d77\u7684\u3002\u90a3\u4e48app.exec_()\u5c31\u8be5\u662fQApplication\u7684\u65b9\u6cd5\uff0c\u4e8e\u662f\u4e4e\u53bb\u67e5\u624b\u518c\u3002\u539f\u6765\u8fd9\u4e2aexec_()\u65b9\u6cd5\u7684\u4f5c\u7528\u662f\u201c\u8fdb\u5165\u7a0b\u5e8f\u7684\u4e3b\u5faa\u73af\u76f4\u5230exit()\u88ab\u8c03\u7528\u201d\uff0c\u8bf4\u767d\u4e86\u5c31\u662f\u8ba9\u8fd9\u4e2a\u7a0b\u5e8f\u8fd0\u884c\u3002<\/p>\n<p>\u5728\u8fd9\u65b9\u9762PyQt\u548cPython\u6709\u4e2a\u5f88\u5927\u7684\u4e0d\u540c\u3002\u867d\u7136Python\u7684\u4e00\u5207\u4e5f\u9700\u8981\u8c03\u7528\u624d\u80fd\u751f\u6548\uff0c\u4f46\u662f\u4e00\u65e6\u88ab\u8c03\u7528\u5c31\u4f1a\u7acb\u5373\u6709\u53cd\u5e94\u3002PyQt\u5219\u662f\u7c7b\u548c\u5bf9\u8c61\u7684\u5c42\u5c42\u5d4c\u5957\uff0c\u9700\u8981\u4f60\u9010\u5c42\u8c03\u7528\u3002\u79c1\u4ee5\u524d\u4e00\u76f4\u4ee5\u4e3a\u8bfb\u8fc7\u201cshow()\u201d\u8fd9\u4e2a\u65b9\u6cd5\u4e4b\u540e\u5c31\u4f1a\u6709\u7a97\u53e3\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\uff0c\u5176\u5b9e\u771f\u6b63\u8ba9\u7a97\u53e3\u663e\u793a\u51fa\u6765\u7684\u5e76\u4e0d\u662f\u8fd9\u4e00\u53e5\uff0c\u8fd9\u4e00\u53e5\u5176\u5b9e\u662f\u4e2a\u754c\u5b9a\u7a97\u53e3\u5728\u4f55\u65f6\u5f39\u51fa\u7684\u201c\u58f0\u660e\u201d\uff0c\u89e3\u91ca\u5668\u8bfb\u53d6\u5230\u8fd9\u91cc\uff0cApplication\u8fd8\u6ca1\u6709\u542f\u52a8\uff0c\u53ea\u662f\u786e\u5b9a\u4e86\u4e00\u65e6\u542f\u52a8\uff0c\u5e94\u8be5\u5728\u201c\u8fd9\u4e2a\u65f6\u5019\u201d\u5f39\u51fa\u8fd9\u4e2a\u7a97\u53e3\u3002\u771f\u6b63\u8ba9\u6574\u4e2a\u7a0b\u5e8f\u8fd0\u8f6c\u7684\u662f\u201csys.exit(app.exec_())\u201d\u91cc\u9762\u5d4c\u5957\u7684\u8fd9\u4e2a\u201capp.exec_()\u201d\uff0c\u800c\u6b63\u662f\u56e0\u4e3a\u8fd9\u4e2a\u5d4c\u5957\uff0c\u8ba9\u79c1\u4e00\u76f4\u8bef\u4ee5\u4e3a\u8fd9\u4e2aapp.exec_()\u662f\u4e00\u4e2a\u8ddf\u9000\u51fa\u201c\u76f4\u63a5\u76f8\u5173\u201d\uff08\u5f53\u7136\u5b83\u4eec\u786e\u5b9e\u4e5f\u76f8\u5173\uff09\u7684\u65b9\u6cd5\uff0c\u4ee5\u81f3\u4e8e\u767e\u601d\u4e0d\u5f97\u5176\u89e3\u3002<\/p>\n<p>\u8bf4\u5230\u5e95\u8fd8\u662f\u81ea\u5df1\u5b66\u827a\u4e0d\u7cbe\u3002\u770b\u6765\u4ee5\u540e\u8fd8\u662f\u8981\u591a\u770b\u624b\u518c\uff0c\u5149\u51ed\u6559\u7a0b\u548c\u81ea\u5df1\u7684\u4e00\u70b9\u7406\u89e3\u662f\u8fdc\u8fdc\u4e0d\u591f\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u79c1\u65e9\u5148\u5c31\u8bf4\u8fc7\uff0c\u79c1\u6bd4\u8f83\u4e60\u60ef\u81ea\u5df1\u5c1d\u8bd5\u3001\u7814\u7a76\uff0c\u662f\u5f88\u770b\u4e0d\u8fdb\u53c2\u8003\u4e66\u7684\u3002Python\u7684\u624b\u518c\u770b\u8fc7\u4e00\u90e8\u5206\uff0c\u540e\u6765\u53d1\u73b0\u5bf9\u79c1\u76f8\u5f53\u6666\u6da9 &#8230; <a title=\"\u7ec8\u4e8e\u77e5\u9053\u8fd9\u4e2aapp.exec_()\u662f\u5565\u610f\u601d\u4e86\" class=\"read-more\" href=\"https:\/\/ukyoi.info\/wordpress\/?p=10218\" aria-label=\"\u9605\u8bfb \u7ec8\u4e8e\u77e5\u9053\u8fd9\u4e2aapp.exec_()\u662f\u5565\u610f\u601d\u4e86\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[52,53],"class_list":["post-10218","post","type-post","status-publish","format-standard","hentry","category--internet","tag-pyqt","tag-python"],"_links":{"self":[{"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10218"}],"version-history":[{"count":0,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10218\/revisions"}],"wp:attachment":[{"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ukyoi.info\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}