{"id":1062868,"date":"2024-12-31T15:55:49","date_gmt":"2024-12-31T07:55:49","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1062868.html"},"modified":"2024-12-31T15:55:52","modified_gmt":"2024-12-31T07:55:52","slug":"python%e5%a6%82%e4%bd%95%e4%bd%bf%e5%bc%b9%e5%87%ba%e7%9a%84gui%e7%bd%ae%e4%ba%8e%e5%ba%95%e5%b1%82","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1062868.html","title":{"rendered":"python\u5982\u4f55\u4f7f\u5f39\u51fa\u7684gui\u7f6e\u4e8e\u5e95\u5c42"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/33c9fb2b-1e4f-4bf1-bb7a-2abdb100f232.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"python\u5982\u4f55\u4f7f\u5f39\u51fa\u7684gui\u7f6e\u4e8e\u5e95\u5c42\" \/><\/p>\n<p><p> <strong>\u8981\u4f7f\u5f39\u51fa\u7684Python GUI\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u6cd5\uff1a\u4f7f\u7528<code>root.lower()<\/code>\u65b9\u6cd5\u3001\u8c03\u6574\u7a97\u53e3\u5c5e\u6027\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u3002<\/strong>\u4e0b\u9762\u6211\u4eec\u5c06\u8be6\u7ec6\u8ba8\u8bba\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff1a\u4f7f\u7528<code>root.lower()<\/code>\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p><code>root.lower()<\/code>\u65b9\u6cd5\u662fTkinter\u5e93\u4e2d\u7528\u6765\u5c06\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\u7684\u4e00\u4e2a\u51fd\u6570\u3002\u901a\u8fc7\u8c03\u7528\u8fd9\u4e2a\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06\u7a97\u53e3\u79fb\u5230\u5176\u4ed6\u6240\u6709\u7a97\u53e3\u7684\u4e0b\u9762\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tkinter as tk<\/p>\n<p>def create_window():<\/p>\n<p>    window = tk.Toplevel(root)<\/p>\n<p>    window.title(&quot;New Window&quot;)<\/p>\n<p>    window.geometry(&quot;200x100&quot;)<\/p>\n<p>    # \u5c06\u65b0\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42<\/p>\n<p>    window.lower()<\/p>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&quot;M<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n Window&quot;)<\/p>\n<p>root.geometry(&quot;300x200&quot;)<\/p>\n<p>button = tk.Button(root, text=&quot;Create Window&quot;, command=create_window)<\/p>\n<p>button.pack(pady=20)<\/p>\n<p>root.mainloop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5f53\u70b9\u51fb\u6309\u94ae\u65f6\uff0c\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7a97\u53e3\u5e76\u7acb\u5373\u5c06\u5176\u7f6e\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528 Tkinter \u7684 <code>lower()<\/code> \u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>Tkinter \u662f Python \u5185\u7f6e\u7684 GUI \u5e93\u3002\u8981\u4f7f\u7528 Tkinter \u7684 <code>lower()<\/code> \u65b9\u6cd5\u5c06\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\uff0c\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u521b\u5efa\u4e3b\u7a97\u53e3\u548c\u5b50\u7a97\u53e3<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u4e3b\u7a97\u53e3\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2a\u5b50\u7a97\u53e3\u3002\u5728\u5b50\u7a97\u53e3\u521b\u5efa\u4e4b\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 <code>lower()<\/code> \u65b9\u6cd5\u5c06\u5176\u7f6e\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tkinter as tk<\/p>\n<p>def create_window():<\/p>\n<p>    window = tk.Toplevel(root)<\/p>\n<p>    window.title(&quot;New Window&quot;)<\/p>\n<p>    window.geometry(&quot;200x100&quot;)<\/p>\n<p>    # \u5c06\u65b0\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42<\/p>\n<p>    window.lower()<\/p>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&quot;Main Window&quot;)<\/p>\n<p>root.geometry(&quot;300x200&quot;)<\/p>\n<p>button = tk.Button(root, text=&quot;Create Window&quot;, command=create_window)<\/p>\n<p>button.pack(pady=20)<\/p>\n<p>root.mainloop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5f53\u70b9\u51fb\u6309\u94ae\u65f6\uff0c\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7a97\u53e3\u5e76\u7acb\u5373\u5c06\u5176\u7f6e\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528 <code>after()<\/code> \u65b9\u6cd5\u5ef6\u8fdf\u6267\u884c<\/h4>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u76f4\u63a5\u8c03\u7528 <code>lower()<\/code> \u65b9\u6cd5\u53ef\u80fd\u4e0d\u4f1a\u7acb\u5373\u751f\u6548\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 <code>after()<\/code> \u65b9\u6cd5\u6765\u5ef6\u8fdf\u6267\u884c <code>lower()<\/code> \u65b9\u6cd5\uff0c\u4ee5\u786e\u4fdd\u7a97\u53e3\u5df2\u7ecf\u5b8c\u5168\u521b\u5efa\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tkinter as tk<\/p>\n<p>def create_window():<\/p>\n<p>    window = tk.Toplevel(root)<\/p>\n<p>    window.title(&quot;New Window&quot;)<\/p>\n<p>    window.geometry(&quot;200x100&quot;)<\/p>\n<p>    # \u5ef6\u8fdf\u6267\u884c lower() \u65b9\u6cd5<\/p>\n<p>    window.after(1, window.lower)<\/p>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&quot;Main Window&quot;)<\/p>\n<p>root.geometry(&quot;300x200&quot;)<\/p>\n<p>button = tk.Button(root, text=&quot;Create Window&quot;, command=create_window)<\/p>\n<p>button.pack(pady=20)<\/p>\n<p>root.mainloop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 <code>after()<\/code> \u65b9\u6cd5\u5c06 <code>lower()<\/code> \u65b9\u6cd5\u7684\u6267\u884c\u5ef6\u8fdf\u4e86 1 \u6beb\u79d2\uff0c\u4ee5\u786e\u4fdd\u7a97\u53e3\u5df2\u7ecf\u5b8c\u5168\u521b\u5efa\u5e76\u53ef\u4ee5\u88ab\u7f6e\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u8c03\u6574\u7a97\u53e3\u5c5e\u6027<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u4f7f\u7528 Tkinter \u7684 <code>lower()<\/code> \u65b9\u6cd5\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u7a97\u53e3\u7684\u5c5e\u6027\u6765\u5c06\u5176\u7f6e\u4e8e\u5e95\u5c42\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 <code>wm_attributes()<\/code> \u65b9\u6cd5\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528 <code>wm_attributes()<\/code> \u65b9\u6cd5\u8bbe\u7f6e\u7a97\u53e3\u5c5e\u6027<\/h4>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u4f7f\u7528 <code>wm_attributes()<\/code> \u65b9\u6cd5\u8bbe\u7f6e\u7a97\u53e3\u7684\u5c5e\u6027\uff0c\u4ee5\u786e\u4fdd\u5b83\u59cb\u7ec8\u5904\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tkinter as tk<\/p>\n<p>def create_window():<\/p>\n<p>    window = tk.Toplevel(root)<\/p>\n<p>    window.title(&quot;New Window&quot;)<\/p>\n<p>    window.geometry(&quot;200x100&quot;)<\/p>\n<p>    # \u8bbe\u7f6e\u7a97\u53e3\u5c5e\u6027\uff0c\u4f7f\u5176\u59cb\u7ec8\u5904\u4e8e\u5e95\u5c42<\/p>\n<p>    window.wm_attributes(&quot;-to<a href=\"https:\/\/docs.pingcode.com\/blog\/project-management\/52627.html\" target=\"_blank\">PMO<\/a>st&quot;, False)<\/p>\n<p>    window.lower()<\/p>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&quot;Main Window&quot;)<\/p>\n<p>root.geometry(&quot;300x200&quot;)<\/p>\n<p>button = tk.Button(root, text=&quot;Create Window&quot;, command=create_window)<\/p>\n<p>button.pack(pady=20)<\/p>\n<p>root.mainloop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 <code>wm_attributes()<\/code> \u65b9\u6cd5\u5c06\u7a97\u53e3\u7684 <code>-topmost<\/code> \u5c5e\u6027\u8bbe\u7f6e\u4e3a <code>False<\/code>\uff0c\u4ee5\u786e\u4fdd\u5b83\u4e0d\u4f1a\u5904\u4e8e\u9876\u5c42\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u7ed3\u5408 <code>lower()<\/code> \u65b9\u6cd5\u548c\u7a97\u53e3\u5c5e\u6027<\/h4>\n<\/p>\n<p><p>\u60a8\u53ef\u4ee5\u5c06 <code>wm_attributes()<\/code> \u65b9\u6cd5\u4e0e <code>lower()<\/code> \u65b9\u6cd5\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u786e\u4fdd\u7a97\u53e3\u59cb\u7ec8\u5904\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tkinter as tk<\/p>\n<p>def create_window():<\/p>\n<p>    window = tk.Toplevel(root)<\/p>\n<p>    window.title(&quot;New Window&quot;)<\/p>\n<p>    window.geometry(&quot;200x100&quot;)<\/p>\n<p>    # \u8bbe\u7f6e\u7a97\u53e3\u5c5e\u6027\uff0c\u4f7f\u5176\u59cb\u7ec8\u5904\u4e8e\u5e95\u5c42<\/p>\n<p>    window.wm_attributes(&quot;-topmost&quot;, False)<\/p>\n<p>    # \u5ef6\u8fdf\u6267\u884c lower() \u65b9\u6cd5<\/p>\n<p>    window.after(1, window.lower)<\/p>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&quot;Main Window&quot;)<\/p>\n<p>root.geometry(&quot;300x200&quot;)<\/p>\n<p>button = tk.Button(root, text=&quot;Create Window&quot;, command=create_window)<\/p>\n<p>button.pack(pady=20)<\/p>\n<p>root.mainloop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u7ed3\u5408\u4f7f\u7528\u4e86 <code>wm_attributes()<\/code> \u65b9\u6cd5\u548c <code>after()<\/code> \u65b9\u6cd5\uff0c\u4ee5\u786e\u4fdd\u7a97\u53e3\u59cb\u7ec8\u5904\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93<\/h3>\n<\/p>\n<p><p>\u9664\u4e86 Tkinter \u4e4b\u5916\uff0c\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u7b2c\u4e09\u65b9\u5e93\u6765\u521b\u5efa\u548c\u7ba1\u7406 GUI \u7a97\u53e3\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u7b2c\u4e09\u65b9\u5e93\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528 PyQt5<\/h4>\n<\/p>\n<p><p>PyQt5 \u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684 Python GUI \u5e93\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u521b\u5efa\u548c\u7ba1\u7406\u7a97\u53e3\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u4ee3\u7801\uff0c\u6f14\u793a\u5982\u4f55\u4f7f\u7528 PyQt5 \u5c06\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from PyQt5 import QtWidgets<\/p>\n<p>import sys<\/p>\n<p>def create_window():<\/p>\n<p>    window = QtWidgets.QWidget()<\/p>\n<p>    window.setWindowTitle(&quot;New Window&quot;)<\/p>\n<p>    window.setGeometry(100, 100, 200, 100)<\/p>\n<p>    # \u5c06\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42<\/p>\n<p>    window.setWindowFlags(window.windowFlags() &amp; ~QtCore.Qt.WindowStaysOnTopHint)<\/p>\n<p>    window.show()<\/p>\n<p>app = QtWidgets.QApplication(sys.argv)<\/p>\n<p>root = QtWidgets.QWidget()<\/p>\n<p>root.setWindowTitle(&quot;Main Window&quot;)<\/p>\n<p>root.setGeometry(100, 100, 300, 200)<\/p>\n<p>button = QtWidgets.QPushButton(&quot;Create Window&quot;, root)<\/p>\n<p>button.clicked.connect(create_window)<\/p>\n<p>button.setGeometry(100, 80, 100, 30)<\/p>\n<p>root.show()<\/p>\n<p>sys.exit(app.exec_())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 PyQt5 \u521b\u5efa\u4e86\u4e00\u4e2a\u4e3b\u7a97\u53e3\u548c\u4e00\u4e2a\u5b50\u7a97\u53e3\uff0c\u5e76\u4f7f\u7528 <code>setWindowFlags()<\/code> \u65b9\u6cd5\u5c06\u5b50\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528 wxPython<\/h4>\n<\/p>\n<p><p>wxPython \u662f\u53e6\u4e00\u4e2a\u6d41\u884c\u7684 Python GUI \u5e93\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u521b\u5efa\u548c\u7ba1\u7406\u7a97\u53e3\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u4ee3\u7801\uff0c\u6f14\u793a\u5982\u4f55\u4f7f\u7528 wxPython \u5c06\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\u3002<\/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>        self.frame = MainFrame(None, title=&quot;Main Window&quot;)<\/p>\n<p>        self.frame.Show()<\/p>\n<p>        return True<\/p>\n<p>class MainFrame(wx.Frame):<\/p>\n<p>    def __init__(self, *args, kw):<\/p>\n<p>        super(MainFrame, self).__init__(*args, kw)<\/p>\n<p>        panel = wx.Panel(self)<\/p>\n<p>        button = wx.Button(panel, label=&quot;Create Window&quot;, pos=(100, 80))<\/p>\n<p>        button.Bind(wx.EVT_BUTTON, self.on_create_window)<\/p>\n<p>    def on_create_window(self, event):<\/p>\n<p>        window = wx.Frame(None, title=&quot;New Window&quot;, size=(200, 100))<\/p>\n<p>        # \u5c06\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42<\/p>\n<p>        window.Lower()<\/p>\n<p>        window.Show()<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    app = MyApp()<\/p>\n<p>    app.MainLoop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 wxPython \u521b\u5efa\u4e86\u4e00\u4e2a\u4e3b\u7a97\u53e3\u548c\u4e00\u4e2a\u5b50\u7a97\u53e3\uff0c\u5e76\u4f7f\u7528 <code>Lower()<\/code> \u65b9\u6cd5\u5c06\u5b50\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u8ba8\u8bba\u4e86\u5982\u4f55\u4f7f\u5f39\u51fa\u7684 Python GUI \u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\u7684\u65b9\u6cd5\u3002\u6211\u4eec\u4ecb\u7ecd\u4e86\u4f7f\u7528 Tkinter \u7684 <code>lower()<\/code> \u65b9\u6cd5\u3001\u8c03\u6574\u7a97\u53e3\u5c5e\u6027\u4ee5\u53ca\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\uff08\u5982 PyQt5 \u548c wxPython\uff09\u6765\u5b9e\u73b0\u8fd9\u4e00\u76ee\u6807\u3002\u65e0\u8bba\u60a8\u4f7f\u7528\u54ea\u79cd\u65b9\u6cd5\uff0c\u90fd\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u9002\u5408\u81ea\u5df1\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u4ee5\u786e\u4fdd\u7a97\u53e3\u7684\u6b63\u786e\u5c42\u6b21\u4f4d\u7f6e\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u521b\u5efa\u4e00\u4e2a\u5f39\u51fa\u7a97\u53e3\u5e76\u5c06\u5176\u7f6e\u4e8e\u5e95\u5c42\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Tkinter\u5e93\u6765\u521b\u5efa\u5f39\u51fa\u7a97\u53e3\u3002\u8981\u5c06\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\uff0c\u53ef\u4ee5\u4f7f\u7528<code>attributes<\/code>\u65b9\u6cd5\u8bbe\u7f6e<code>-topmost<\/code>\u5c5e\u6027\u4e3a<code>False<\/code>\uff0c\u540c\u65f6\u786e\u4fdd\u5176\u4ed6\u7a97\u53e3\u5728\u5176\u4e0a\u65b9\u663e\u793a\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">import tkinter as tk\n\nroot = tk.Tk()\nroot.withdraw()  # \u9690\u85cf\u4e3b\u7a97\u53e3\n\npopup = tk.Toplevel()  # \u521b\u5efa\u5f39\u51fa\u7a97\u53e3\npopup.attributes(&#39;-topmost&#39;, False)  # \u4f7f\u5f39\u51fa\u7a97\u53e3\u4e0d\u5728\u6700\u4e0a\u5c42\n\npopup.mainloop()  # \u542f\u52a8\u4e3b\u5faa\u73af\n<\/code><\/pre>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u4f7f\u7528\u5176\u4ed6\u5e93\u6765\u521b\u5efa\u5e95\u5c42\u5f39\u51fa\u7a97\u53e3\uff1f<\/strong><br \/>\u9664\u4e86Tkinter\uff0cPython\u8fd8\u6709\u5176\u4ed6GUI\u5e93\u53ef\u4ee5\u5b9e\u73b0\u7c7b\u4f3c\u529f\u80fd\uff0c\u4f8b\u5982PyQt\u6216wxPython\u3002\u4f7f\u7528PyQt\u65f6\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u7a97\u53e3\u7684\u5c42\u7ea7\u5c5e\u6027\uff0c\u5c06\u5176\u7f6e\u4e8e\u5e95\u5c42\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f7f\u7528PyQt\u7684\u793a\u4f8b\uff1a  <\/p>\n<pre><code class=\"language-python\">from PyQt5.QtWidgets import QApplication, QDialog\n\napp = QApplication([])\ndialog = QDialog()\ndialog.setWindowFlags(dialog.windowFlags() | Qt.WindowStaysOnBottomHint)  # \u8bbe\u7f6e\u5e95\u5c42\u5c5e\u6027\ndialog.show()\napp.exec_()\n<\/code><\/pre>\n<p><strong>\u5728\u8bbe\u7f6e\u5f39\u51fa\u7a97\u53e3\u4e3a\u5e95\u5c42\u65f6\uff0c\u662f\u5426\u4f1a\u5f71\u54cd\u7528\u6237\u4ea4\u4e92\u4f53\u9a8c\uff1f<\/strong><br \/>\u5c06\u5f39\u51fa\u7a97\u53e3\u8bbe\u7f6e\u4e3a\u5e95\u5c42\u53ef\u80fd\u4f1a\u5f71\u54cd\u7528\u6237\u7684\u4ea4\u4e92\u4f53\u9a8c\uff0c\u56e0\u4e3a\u7528\u6237\u53ef\u80fd\u9700\u8981\u9891\u7e41\u5207\u6362\u7a97\u53e3\u3002\u5982\u679c\u5f39\u51fa\u7a97\u53e3\u5305\u542b\u91cd\u8981\u4fe1\u606f\uff0c\u5efa\u8bae\u4f7f\u7528\u63d0\u793a\u6846\u6216\u5728\u4e3b\u7a97\u53e3\u4e2d\u5d4c\u5165\u76f8\u5173\u5185\u5bb9\uff0c\u4ee5\u786e\u4fdd\u7528\u6237\u80fd\u591f\u65b9\u4fbf\u5730\u8bbf\u95ee\u4fe1\u606f\u800c\u4e0d\u88ab\u6253\u65ad\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u4f7f\u5f39\u51fa\u7684Python GUI\u7a97\u53e3\u7f6e\u4e8e\u5e95\u5c42\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u6cd5\uff1a\u4f7f\u7528root.lower()\u65b9\u6cd5\u3001\u8c03\u6574\u7a97\u53e3\u5c5e [&hellip;]","protected":false},"author":3,"featured_media":1062882,"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\/1062868"}],"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=1062868"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1062868\/revisions"}],"predecessor-version":[{"id":1062885,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1062868\/revisions\/1062885"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1062882"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1062868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1062868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1062868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}