{"id":1322,"date":"2023-06-27T12:19:23","date_gmt":"2023-06-27T04:19:23","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/ruanjiankf\/1322\/"},"modified":"2023-06-27T12:19:23","modified_gmt":"2023-06-27T04:19:23","slug":"gui%e4%bb%a5%e5%8f%8a%e7%94%9f%e6%88%90exe%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/ruanjiankf\/1322\/","title":{"rendered":"gui\u4ee5\u53ca\u751f\u6210exe\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u5e26\u6709 GUI\uff08\u56fe\u5f62\u7528\u6237\u754c\u9762\uff09\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5c06\u5176\u8f6c\u6362\u6210\u4e00\u4e2a\u72ec\u7acb\u7684 EXE \u53ef\u6267\u884c\u6587\u4ef6\u3002\u6211\u4eec\u5c06\u9996\u5148\u5bf9 GUI \u548c EXE \u6587\u4ef6\u7684\u539f\u7406\u8fdb\u884c\u7b80\u8981\u7684\u4ecb\u7ecd\uff0c\u7136\u540e\u901a\u8fc7\u4e00\u4e2a\u7b80\u5355\u7684\u5b9e\u4f8b\u6765\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u5e26\u6709 GUI \u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u4ee5\u53ca\u5982\u4f55\u5c06\u5176\u8f6c\u6362\u6210\u4e00\u4e2a\u72ec\u7acb\u7684 EXE \u6587\u4ef6\u3002<\/p>\n<p>**GUI\uff08Graphical User Interface\uff09\u539f\u7406**<\/p>\n<p>\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09\u662f\u8ba1\u7b97\u673a\u7a0b\u5e8f\u4e0e\u7528\u6237\u4e4b\u95f4\u8fdb\u884c\u4ea4\u4e92\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u5b83\u901a\u5e38\u6bd4\u547d\u4ee4\u884c\u754c\u9762\u66f4\u6613\u4e8e\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b83\u4f7f\u7528\u56fe\u5f62\u548c\u6587\u672c\u6765\u8868\u793a\u8f93\u5165\u548c\u8f93\u51fa\u7684\u4fe1\u606f\uff0c\u800c\u4e0d\u662f\u4ec5\u4f9d\u8d56\u4e8e<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/16\/10\/13079598893.jpg\" \/><\/figure>\n<\/p>\n<p>\u6587\u672c\u3002GUI \u6211\u4eec\u6240\u719f\u6089\u7684\u5f62\u5f0f\u6709\u6309\u94ae\u3001\u6eda\u52a8\u6761\u3001\u7a97\u53e3\u7b49\u3002<\/p>\n<p>**EXE\uff08\u53ef\u6267\u884c\u6587\u4ef6\uff09\u539f\u7406**<\/p>\n<p>EXE \u662f\u4e00\u79cd\u5e38\u89c1\u7684\u7a0b\u5e8f\u6587\u4ef6\u7c7b\u578b\uff0c\u7528\u4e8e\u5728 Windows \u7cfb\u7edf\u4e2d\u5b58\u50a8\u53ef\u6267\u884c\u4ee3\u7801\u3002EXE \u6587\u4ef6\u5305\u542b\u4e86\u4e00\u4e2a\u7a0b\u5e8f\u7684\u6240\u6709\u4ee3\u7801\u548c\u6570\u636e\uff0c\u4ee5\u53ca\u8fd0\u884c\u8be5\u7a0b\u5e8f\u6240\u9700\u7684\u6240\u6709\u76f8\u5173\u4fe1\u606f\u3002\u5f53\u7528\u6237\u53cc\u51fb\u4e00\u4e2a EXE \u6587\u4ef6\u65f6\uff0c\u64cd\u4f5c\u7cfb\u7edf\u5c06\u52a0\u8f7d\u8be5\u6587\u4ef6\uff0c\u5e76\u6839\u636e\u5176\u4e2d\u7684\u4fe1\u606f\u6765\u6267\u884c\u7a0b\u5e8f\u3002<\/p>\n<p>**\u521b\u5efa\u4e00\u4e2a\u5e26\u6709 GUI \u7684\u5e94\u7528\u7a0b\u5e8f**<\/p>\n<p>\u6211\u4eec\u5c06\u4f7f\u7528 Python \u4f5c\u4e3a\u7f16\u7a0b\u8bed\u8a00\uff0c\u4ee5\u53ca\u4e00\u4e2a\u540d\u4e3a Tkinter \u7684\u5e93\u6765\u521b\u5efa GUI\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5e26\u6709 GUI \u7684 Hello World \u5e94\u7528\u7a0b\u5e8f\u7684\u793a\u4f8b\uff1a<\/p>\n<p>&#8220;`python<\/p>\n<p>import tkinter as tk<\/p>\n<p>def on_click():<\/p>\n<p>    print(&#8220;Hello World&#8221;)<\/p>\n<p># \u521b\u5efa\u4e3b\u7a97\u53e3<\/p>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&#8220;Hello World GUI&#8221;)<\/p>\n<p># \u521b\u5efa\u6309\u94ae\u5e76\u6dfb\u52a0\u5230\u4e3b\u7a97\u53e3<\/p>\n<p>button = tk.Button(root, text=&#8221;\u70b9\u51fb\u6211&#8221;, command=on_click)<\/p>\n<p>button.pack(pady=20)<\/p>\n<p># \u8fd0\u884c\u4e3b\u5faa\u73af<\/p>\n<p>root.mainloop()<\/p>\n<p>&#8220;`<\/p>\n<p>**\u5c06\u5e94\u7528\u7a0b\u5e8f\u8f6c\u6362\u6210 EXE \u6587\u4ef6**<\/p>\n<p>\u6211\u4eec\u5c06\u4f7f\u7528\u4e00\u4e2a\u540d\u4e3a PyInstaller \u7684\u5de5\u5177\u6765\u5c06\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u8f6c\u6362\u6210\u4e00\u4e2a\u72ec\u7acb\u7684 EXE \u6587\u4ef6\u3002\u9996\u5148\uff0c\u5b89\u88c5 PyInstaller\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>pip install pyinstaller<\/p>\n<p>&#8220;`<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528 PyInstaller \u5c06\u4e0a\u9762\u7684 Python \u811a\u672c (\u4f8b\u5982\uff1ahello_gui.py) \u8f6c\u6362\u6210\u4e00\u4e2a EXE \u6587\u4ef6\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>pyinstaller &#8211;onefile &#8211;windowed hello_gui.py<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3a `hello_gui.exe` \u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c<a href=\"https:\/\/www.yimenexe.com\/ruanjian-kaifa-1318.html\">matlab\u600e\u6837\u751f\u6210exe<\/a>\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u53cc\u51fb\u8fd0\u884c\u8be5\u6587\u4ef6\uff0c\u65e0\u9700\u5b89\u88c5 Python \u6216\u5176\u4ed6\u4f9d\u8d56\u5e93\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u7b80\u8981\u4ecb\u7ecd\u4e86 GUI \u548c EXE \u6587\u4ef6\u7684\u539f\u7406\uff0c\u7136\u540e\u901a\u8fc7\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55<a href=\"https:\/\/exe.yimenapp.com\/tool-2873.html\">ubuntu\u5f00\u53d1\u5c0f\u7a0b\u5e8f<\/a>\u521b\u5efa\u4e00\u4e2a\u5e26\u6709 GUI \u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u4ee5\u53ca\u5982\u4f55\u5c06\u5176\u8f6c\u6362\u6210\u4e00\u4e2a\u72ec\u7acb\u7684 EXE \u6587\u4ef6\u3002\u6709\u4e86\u8fd9\u4e9b\u77e5\u8bc6\uff0c\u5e0c\u671b\u4f60\u80fd\u591f\u8f7b\u677e\u5730\u521b\u5efa\u81ea\u5df1\u7684\u5e26\u6709\u56fe\u5f62\u7528\u6237\u754c\u9762\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5c06\u5176\u53d1\u5e03\u7ed9\u5176\u4ed6\u7528\u6237\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u5e26\u6709 GUI\uff08\u56fe\u5f62\u7528\u6237\u754c\u9762\uff09\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5c06\u5176\u8f6c\u6362\u6210\u4e00\u4e2a\u72ec\u7acb\u7684 EXE \u53ef\u6267\u884c\u6587\u4ef6\u3002\u6211\u4eec\u5c06\u9996\u5148\u5bf9 GUI \u548c EXE \u6587\u4ef6\u7684\u539f\u7406\u8fdb\u884c\u7b80\u8981\u7684\u4ecb\u7ecd\uff0c\u7136\u540e\u901a\u8fc7\u4e00\u4e2a\u7b80\u5355\u7684<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[2858,2859,11,81,2860],"topic":[],"class_list":["post-1322","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-exe","tag-luaexerequire","tag-11","tag-81","tag-2860"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/1322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=1322"}],"version-history":[{"count":0,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/1322\/revisions"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=1322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=1322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=1322"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=1322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}