{"id":930871,"date":"2024-12-26T17:25:44","date_gmt":"2024-12-26T09:25:44","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/930871.html"},"modified":"2024-12-26T17:25:45","modified_gmt":"2024-12-26T09:25:45","slug":"%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85python-wx","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/930871.html","title":{"rendered":"\u5982\u4f55\u5b89\u88c5python wx"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25065423\/09e9e1c5-b731-4ca4-b575-06a9661cee26.webp\" alt=\"\u5982\u4f55\u5b89\u88c5python wx\" \/><\/p>\n<p><p> <strong>\u5b89\u88c5Python wx\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u786e\u8ba4Python\u7248\u672c\u3001\u4f7f\u7528pip\u5b89\u88c5wxPython\u3001\u9a8c\u8bc1\u5b89\u88c5\u6210\u529f\u4e0e\u5426<\/strong>\u3002\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684Python\u7248\u672c\u662f3.6\u53ca\u4ee5\u4e0a\uff0c\u56e0\u4e3awxPython\u7684\u6700\u65b0\u7248\u672c\u4e0e\u8fd9\u4e9bPython\u7248\u672c\u517c\u5bb9\u3002\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528Python\u7684\u5305\u7ba1\u7406\u5de5\u5177pip\u6765\u5b89\u88c5wxPython\u3002\u5728\u547d\u4ee4\u884c\u8f93\u5165<code>pip install wxPython<\/code>\u5373\u53ef\u5f00\u59cb\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u5bfc\u5165wx\u5e93\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u786e\u8ba4Python\u7248\u672c<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5wxPython\u4e4b\u524d\uff0c\u786e\u4fdd\u4f60\u7684Python\u7248\u672c\u7b26\u5408\u8981\u6c42\u3002wxPython\u6700\u65b0\u7248\u672c\u652f\u6301Python 3.6\u53ca\u4ee5\u4e0a\u7248\u672c\u3002\u4ee5\u4e0b\u662f\u786e\u8ba4Python\u7248\u672c\u7684\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u68c0\u67e5\u5df2\u5b89\u88c5\u7684Python\u7248\u672c<\/strong><br \/>\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u663e\u793a\u7684\u7248\u672c\u662f3.6\u6216\u66f4\u9ad8\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u7ee7\u7eed\u8fdb\u884c\u5b89\u88c5\u3002\u5982\u679c\u4e0d\u662f\uff0c\u5219\u9700\u8981\u5347\u7ea7Python\u7248\u672c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5347\u7ea7Python\u7248\u672c<\/strong><br \/>\u5982\u679c\u4f60\u7684Python\u7248\u672c\u8fc7\u4f4e\uff0c\u53ef\u4ee5\u8bbf\u95eePython\u7684<a href=\"https:\/\/www.python.org\/downloads\/\">\u5b98\u65b9\u7f51\u7ad9<\/a>\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u5e76\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u786e\u4fdd\u9009\u62e9\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edfPATH\u7684\u9009\u9879\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u4f7f\u7528pip\u5b89\u88c5wxPython<\/h3>\n<\/p>\n<p><p>wxPython\u662f\u901a\u8fc7Python\u7684\u5305\u7ba1\u7406\u5de5\u5177pip\u6765\u5b89\u88c5\u7684\u3002pip\u901a\u5e38\u968f\u7740Python\u7684\u5b89\u88c5\u4e00\u8d77\u5b89\u88c5\u3002\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u6ca1\u6709pip\uff0c\u53ef\u4ee5\u5355\u72ec\u5b89\u88c5\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5pip\uff08\u5982\u679c\u672a\u5b89\u88c5\uff09<\/strong><br \/>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5pip\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m ensurepip --upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 -m ensurepip --upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5wxPython<\/strong><br \/>\u4e00\u65e6\u786e\u8ba4pip\u5df2\u5b89\u88c5\u5e76\u53ef\u7528\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5wxPython\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install wxPython<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 install wxPython<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u6ce8\u610f<\/strong>\uff1a\u5b89\u88c5\u8fc7\u7a0b\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff0c\u5e76\u4e14\u53ef\u80fd\u9700\u8981\u7ba1\u7406\u5458\u6743\u9650\u3002\u5982\u679c\u5b89\u88c5\u9047\u5230\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528<code>--user<\/code>\u6807\u5fd7\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install --user wxPython<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u9a8c\u8bc1\u5b89\u88c5\u6210\u529f\u4e0e\u5426<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u5bfc\u5165wx\u5e93\u6765\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684Python\u811a\u672c<\/strong><br \/>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>test_wx.py<\/code>\u7684\u6587\u4ef6\uff0c\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import wx<\/p>\n<p>app = wx.App(False)<\/p>\n<p>frame = wx.Frame(None, wx.ID_ANY, &quot;Hello World&quot;)<\/p>\n<p>frame.Show(True)<\/p>\n<p>app.M<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>nLoop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u811a\u672c<\/strong><br \/>\u5728\u547d\u4ee4\u884c\u4e2d\u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\uff0c\u5e76\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python test_wx.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 test_wx.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u770b\u5230\u4e00\u4e2a\u6807\u9898\u4e3a\u201cHello World\u201d\u7684\u7a97\u53e3\u5f39\u51fa\uff0c\u8bf4\u660ewxPython\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u89e3\u51b3\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u9047\u5230\u7684\u95ee\u9898<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5wxPython\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u95ee\u9898\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7f51\u7edc\u95ee\u9898<\/strong><br \/>\u5982\u679c\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u9047\u5230\u7f51\u7edc\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u56fd\u5185\u7684\u955c\u50cf\u6e90\u6765\u52a0\u901f\u4e0b\u8f7d\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u963f\u91cc\u4e91\u7684\u955c\u50cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install -i https:\/\/mirrors.aliyun.com\/pypi\/simple\/ wxPython<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6743\u9650\u95ee\u9898<\/strong><br \/>\u5982\u679c\u6ca1\u6709\u6743\u9650\u5b89\u88c5\u8f6f\u4ef6\u5305\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5728\u547d\u4ee4\u524d\u6dfb\u52a0<code>sudo<\/code>\uff08\u9002\u7528\u4e8eLinux\u548cMacOS\uff09\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo pip install wxPython<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005\u4f7f\u7528<code>--user<\/code>\u6807\u5fd7\u8fdb\u884c\u7528\u6237\u7ea7\u522b\u7684\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u517c\u5bb9\u6027\u95ee\u9898<\/strong><br \/>\u786e\u4fdd\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u548cPython\u7248\u672c\u662fwxPython\u652f\u6301\u7684\u7248\u672c\u3002\u5bf9\u4e8e\u67d0\u4e9b\u64cd\u4f5c\u7cfb\u7edf\uff08\u5982\u65e7\u7248\u672c\u7684Linux\u53d1\u884c\u7248\uff09\uff0c\u53ef\u80fd\u9700\u8981\u7f16\u8bd1wxPython\uff0c\u8fd9\u53ef\u80fd\u4f1a\u6d89\u53ca\u5230\u5b89\u88c5\u5f00\u53d1\u5de5\u5177\u548c\u4f9d\u8d56\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u6df1\u5165\u4e86\u89e3wxPython\u7684\u529f\u80fd<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u6210\u529f\u540e\uff0c\u4f60\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528wxPython\u6765\u5f00\u53d1\u56fe\u5f62\u7528\u6237\u754c\u9762\u5e94\u7528\u3002wxPython\u662f\u4e00\u4e2a\u5f3a\u5927\u7684GUI\u5e93\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u63a7\u4ef6\u548c\u5e03\u5c40\u7ba1\u7406\u5668\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9bwxPython\u7684\u6838\u5fc3\u529f\u80fd\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7a97\u53e3\u548c\u5bf9\u8bdd\u6846<\/strong><br \/>wxPython\u63d0\u4f9b\u4e86\u591a\u79cd\u7a97\u53e3\u548c\u5bf9\u8bdd\u6846\u7c7b\u578b\uff0c\u5982\u4e3b\u7a97\u53e3\uff08Frame\uff09\u3001\u5bf9\u8bdd\u6846\uff08Dialog\uff09\u3001\u6d88\u606f\u6846\uff08MessageBox\uff09\u7b49\u3002\u8fd9\u4e9b\u63a7\u4ef6\u53ef\u4ee5\u7528\u4e8e\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f\u7684\u4e3b\u754c\u9762\u548c\u7528\u6237\u4ea4\u4e92\u754c\u9762\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5e03\u5c40\u7ba1\u7406\u5668<\/strong><br \/>wxPython\u652f\u6301\u591a\u79cd\u5e03\u5c40\u7ba1\u7406\u5668\uff0c\u5982BoxSizer\u3001GridSizer\u3001FlexGridSizer\u7b49\u3002\u8fd9\u4e9b\u5e03\u5c40\u7ba1\u7406\u5668\u7528\u4e8e\u7ba1\u7406\u63a7\u4ef6\u5728\u7a97\u53e3\u4e2d\u7684\u6392\u5217\u65b9\u5f0f\uff0c\u4f7f\u754c\u9762\u8bbe\u8ba1\u66f4\u52a0\u7075\u6d3b\u548c\u76f4\u89c2\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e8b\u4ef6\u5904\u7406<\/strong><br \/>wxPython\u91c7\u7528\u4e8b\u4ef6\u9a71\u52a8\u7684\u7f16\u7a0b\u6a21\u578b\uff0c\u5141\u8bb8\u5f00\u53d1\u8005\u901a\u8fc7\u4e8b\u4ef6\u7ed1\u5b9a\u673a\u5236\u5904\u7406\u7528\u6237\u4ea4\u4e92\u4e8b\u4ef6\u3002\u5e38\u89c1\u7684\u4e8b\u4ef6\u5305\u62ec\u6309\u94ae\u70b9\u51fb\u3001\u9f20\u6807\u79fb\u52a8\u3001\u952e\u76d8\u8f93\u5165\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u81ea\u5b9a\u4e49\u63a7\u4ef6<\/strong><br \/>\u9664\u4e86\u5185\u7f6e\u7684\u63a7\u4ef6\uff0cwxPython\u8fd8\u5141\u8bb8\u5f00\u53d1\u8005\u521b\u5efa\u81ea\u5b9a\u4e49\u63a7\u4ef6\u3002\u901a\u8fc7\u7ee7\u627f\u548c\u6269\u5c55wxPython\u7684\u57fa\u672c\u63a7\u4ef6\u7c7b\uff0c\u53ef\u4ee5\u5b9e\u73b0\u7279\u5b9a\u529f\u80fd\u7684\u63a7\u4ef6\uff0c\u4ee5\u6ee1\u8db3\u5e94\u7528\u7a0b\u5e8f\u7684\u7279\u6b8a\u9700\u6c42\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8de8\u5e73\u53f0\u652f\u6301<\/strong><br \/>wxPython\u662f\u8de8\u5e73\u53f0\u7684\uff0c\u652f\u6301Windows\u3001MacOS\u548cLinux\u3002\u5728\u4e0d\u540c\u5e73\u53f0\u4e0a\uff0cwxPython\u5e94\u7528\u7a0b\u5e8f\u7684\u5916\u89c2\u548c\u884c\u4e3a\u90fd\u975e\u5e38\u4e00\u81f4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e30\u5bcc\u7684\u6587\u6863\u548c\u793e\u533a\u652f\u6301<\/strong><br \/>wxPython\u62e5\u6709\u4e30\u5bcc\u7684\u6587\u6863\u8d44\u6e90\u548c\u6d3b\u8dc3\u7684\u793e\u533a\u652f\u6301\u3002\u5f00\u53d1\u8005\u53ef\u4ee5\u901a\u8fc7\u5b98\u65b9\u6587\u6863\u3001\u5728\u7ebf\u6559\u7a0b\u3001\u8bba\u575b\u548c\u90ae\u4ef6\u5217\u8868\u83b7\u53d6\u5e2e\u52a9\u548c\u652f\u6301\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u516d\u3001\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684wxPython\u5e94\u7528<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u8fdb\u4e00\u6b65\u4e86\u89e3\u5982\u4f55\u4f7f\u7528wxPython\u521b\u5efa\u4e00\u4e2a\u56fe\u5f62\u7528\u6237\u754c\u9762\u5e94\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f\u6846\u67b6<\/strong><br \/>\u4e00\u4e2a\u57fa\u672c\u7684wxPython\u5e94\u7528\u7a0b\u5e8f\u5305\u62ec\u5e94\u7528\u5bf9\u8c61\u548c\u4e3b\u7a97\u53e3\u3002\u4ee5\u4e0b\u662f\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u5e94\u7528\u7a0b\u5e8f\u6846\u67b6\u7684\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import wx<\/p>\n<p>class MyApp(wx.App):<\/p>\n<p>    def OnInit(self):<\/p>\n<p>        frame = MyFrame(None, title=&quot;Simple wxPython App&quot;)<\/p>\n<p>        frame.Show()<\/p>\n<p>        return True<\/p>\n<p>class MyFrame(wx.Frame):<\/p>\n<p>    def __init__(self, parent, title):<\/p>\n<p>        super(MyFrame, self).__init__(parent, title=title, size=(300, 200))<\/p>\n<p>if __name__ == &#39;__main__&#39;:<\/p>\n<p>    app = MyApp()<\/p>\n<p>    app.MainLoop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6dfb\u52a0\u63a7\u4ef6\u548c\u5e03\u5c40<\/strong><br \/>\u5728\u4e3b\u7a97\u53e3\u4e2d\u6dfb\u52a0\u63a7\u4ef6\uff0c\u5e76\u4f7f\u7528\u5e03\u5c40\u7ba1\u7406\u5668\u7ba1\u7406\u63a7\u4ef6\u7684\u6392\u5217\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">class MyFrame(wx.Frame):<\/p>\n<p>    def __init__(self, parent, title):<\/p>\n<p>        super(MyFrame, self).__init__(parent, title=title, size=(300, 200))<\/p>\n<p>        panel = wx.Panel(self)<\/p>\n<p>        vbox = wx.BoxSizer(wx.VERTICAL)<\/p>\n<p>        self.text_ctrl = wx.TextCtrl(panel)<\/p>\n<p>        button = wx.Button(panel, label=&quot;Click Me&quot;)<\/p>\n<p>        vbox.Add(self.text_ctrl, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)<\/p>\n<p>        vbox.Add(button, proportion=0, flag=wx.CENTER|wx.ALL, border=5)<\/p>\n<p>        panel.SetSizer(vbox)<\/p>\n<p>        button.Bind(wx.EVT_BUTTON, self.on_button_click)<\/p>\n<p>    def on_button_click(self, event):<\/p>\n<p>        value = self.text_ctrl.GetValue()<\/p>\n<p>        wx.MessageBox(f&quot;You entered: {value}&quot;, &quot;Info&quot;, wx.OK | wx.ICON_INFORMATION)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f<\/strong><br \/>\u8fd0\u884c\u8fd9\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u5c06\u4f1a\u663e\u793a\u4e00\u4e2a\u7a97\u53e3\uff0c\u5305\u542b\u4e00\u4e2a\u6587\u672c\u6846\u548c\u4e00\u4e2a\u6309\u94ae\u3002\u7528\u6237\u53ef\u4ee5\u5728\u6587\u672c\u6846\u4e2d\u8f93\u5165\u5185\u5bb9\uff0c\u70b9\u51fb\u6309\u94ae\u540e\u4f1a\u5f39\u51fa\u4e00\u4e2a\u6d88\u606f\u6846\u663e\u793a\u8f93\u5165\u7684\u5185\u5bb9\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u8fd9\u4e2a\u793a\u4f8b\uff0c\u4f60\u53ef\u4ee5\u4e86\u89e3\u5230wxPython\u5e94\u7528\u7a0b\u5e8f\u7684\u57fa\u672c\u7ed3\u6784\u548c\u5f00\u53d1\u6d41\u7a0b\u3002wxPython\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u6784\u5efa\u8de8\u5e73\u53f0\u7684GUI\u5e94\u7528\u3002\u901a\u8fc7\u4e0d\u65ad\u5b9e\u8df5\u548c\u63a2\u7d22\uff0c\u4f60\u5c06\u80fd\u591f\u638c\u63e1\u66f4\u591a\u9ad8\u7ea7\u529f\u80fd\u548c\u6280\u5de7\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u6211\u7684\u7cfb\u7edf\u662f\u5426\u5df2\u5b89\u88c5Python\uff1f<\/strong><br \/>\u8981\u786e\u8ba4\u60a8\u7684\u7cfb\u7edf\u4e2d\u662f\u5426\u5df2\u5b89\u88c5Python\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python3 --version<\/code>\u3002\u5982\u679c\u7cfb\u7edf\u8fd4\u56dePython\u7684\u7248\u672c\u53f7\uff0c\u8868\u793a\u5df2\u7ecf\u5b89\u88c5\u3002\u5982\u679c\u6ca1\u6709\uff0c\u60a8\u9700\u8981\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5\u6700\u65b0\u7248\u672c\u3002<\/p>\n<p><strong>wxPython\u7684\u5b89\u88c5\u9700\u8981\u54ea\u4e9b\u524d\u63d0\u6761\u4ef6\uff1f<\/strong><br \/>\u5728\u5b89\u88c5wxPython\u4e4b\u524d\uff0c\u786e\u4fdd\u60a8\u7684Python\u7248\u672c\u7b26\u5408wxPython\u7684\u8981\u6c42\u3002\u901a\u5e38\uff0cwxPython\u652f\u6301Python 3.6\u53ca\u4ee5\u4e0a\u7248\u672c\u3002\u6b64\u5916\uff0c\u60a8\u9700\u8981\u786e\u4fddpip\uff08Python\u5305\u7ba1\u7406\u5de5\u5177\uff09\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u8fd9\u6837\u53ef\u4ee5\u65b9\u4fbf\u5730\u5b89\u88c5wxPython\u3002<\/p>\n<p><strong>\u5728\u5b89\u88c5wxPython\u65f6\u6211\u5e94\u8be5\u9009\u62e9\u54ea\u4e2a\u7248\u672c\uff1f<\/strong><br \/>\u9009\u62e9wxPython\u7684\u7248\u672c\u65f6\uff0c\u5efa\u8bae\u6839\u636e\u60a8\u7684Python\u7248\u672c\u4ee5\u53ca\u64cd\u4f5c\u7cfb\u7edf\u6765\u9009\u62e9\u3002\u60a8\u53ef\u4ee5\u8bbf\u95eewxPython\u7684\u5b98\u65b9\u7f51\u7ad9\uff0c\u67e5\u770b\u4e0d\u540c\u7248\u672c\u7684\u517c\u5bb9\u6027\u4fe1\u606f\u3002\u5bf9\u4e8e\u5927\u591a\u6570\u7528\u6237\uff0c\u5b89\u88c5\u6700\u65b0\u7684\u7a33\u5b9a\u7248\u672c\u901a\u5e38\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\uff0c\u4ee5\u83b7\u5f97\u6700\u65b0\u7684\u529f\u80fd\u548c\u4fee\u590d\u7684\u9519\u8bef\u3002<\/p>\n<p><strong>\u5982\u4f55\u89e3\u51b3wxPython\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u7684\u9519\u8bef\uff1f<\/strong><br \/>\u5728\u5b89\u88c5wxPython\u65f6\uff0c\u82e5\u9047\u5230\u9519\u8bef\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u51e0\u4e2a\u89e3\u51b3\u65b9\u6848\uff1a\u786e\u4fdd\u60a8\u7684pip\u662f\u6700\u65b0\u7248\u672c\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4<code>pip install --upgrade pip<\/code>\u66f4\u65b0\uff1b\u67e5\u770b\u9519\u8bef\u4fe1\u606f\u4ee5\u786e\u5b9a\u7f3a\u5931\u7684\u4f9d\u8d56\u9879\uff0c\u5e76\u624b\u52a8\u5b89\u88c5\u5b83\u4eec\uff1b\u6216\u8005\u53c2\u8003wxPython\u7684\u5b98\u65b9\u6587\u6863\u548c\u793e\u533a\u8bba\u575b\uff0c\u5bfb\u627e\u89e3\u51b3\u65b9\u6848\u548c\u5efa\u8bae\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5b89\u88c5Python wx\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u786e\u8ba4Python\u7248\u672c\u3001\u4f7f\u7528pip\u5b89\u88c5wxPython\u3001\u9a8c\u8bc1\u5b89\u88c5\u6210\u529f\u4e0e\u5426\u3002\u9996\u5148 [&hellip;]","protected":false},"author":3,"featured_media":930872,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/930871"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=930871"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/930871\/revisions"}],"predecessor-version":[{"id":930873,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/930871\/revisions\/930873"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/930872"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=930871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=930871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=930871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}