<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # PyQt 自動補全 > 原文: [https://pythonbasics.org/pyqt-auto-complete/](https://pythonbasics.org/pyqt-auto-complete/) PyQt 支持自動補全。 如果輸入文本框(`QLineEdit`),它可以提出建議。 從列表中推薦這些建議。 本示例將自動補全功能添加到`QLineEdit`文本框中。 ![auto complete QLineEdit](https://img.kancloud.cn/7c/9e/7c9ea57e7d20fe5c7c3f6331c18bdfc4_260x150.jpg) 圖片:在 PyQt 窗口中顯示的標簽。 ## 自動補全 ### `QLineEdit`自動補全示例 首先創建選項(名稱)列表,然后創建`completer = QCompleter(names)`。 使用行`self.lineedit = QLineEdit()`創建行編輯。 否則,行編輯將正常進行。 這些建議已添加到`self.lineedit.setCompleter(completer)`中。 如果忘記了最后一行,則`QCompleter`和`QLineEdit`未連接,這意味著沒有**自動補全**。 ```py from PyQt5.QtWidgets import * import sys class Window(QWidget): def __init__(self): QWidget.__init__(self) layout = QGridLayout() self.setLayout(layout) # auto complete options names = ["Apple", "Alps", "Berry", "Cherry" ] completer = QCompleter(names) # create line edit and add auto complete self.lineedit = QLineEdit() self.lineedit.setCompleter(completer) layout.addWidget(self.lineedit, 0, 0) app = QApplication(sys.argv) screen = Window() screen.show() sys.exit(app.exec_()) ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看