久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='6zlog'><tr id='6zlog'><dt id='6zlog'><q id='6zlog'><span id='6zlog'><b id='6zlog'><form id='6zlog'><ins id='6zlog'></ins><ul id='6zlog'></ul><sub id='6zlog'></sub></form><legend id='6zlog'></legend><bdo id='6zlog'><pre id='6zlog'><center id='6zlog'></center></pre></bdo></b><th id='6zlog'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6zlog'><tfoot id='6zlog'></tfoot><dl id='6zlog'><fieldset id='6zlog'></fieldset></dl></div>
      <tfoot id='6zlog'></tfoot>
      • <bdo id='6zlog'></bdo><ul id='6zlog'></ul>

      <small id='6zlog'></small><noframes id='6zlog'>

        <legend id='6zlog'><style id='6zlog'><dir id='6zlog'><q id='6zlog'></q></dir></style></legend>

        在字符串中按下 QpushButton 時(shí)如何在 QlineEdit 中獲

        How to get text in QlineEdit when QpushButton is pressed in a string?(在字符串中按下 QpushButton 時(shí)如何在 QlineEdit 中獲取文本?)
          <bdo id='k8HZ7'></bdo><ul id='k8HZ7'></ul>
          <legend id='k8HZ7'><style id='k8HZ7'><dir id='k8HZ7'><q id='k8HZ7'></q></dir></style></legend>
        • <tfoot id='k8HZ7'></tfoot>

                  <small id='k8HZ7'></small><noframes id='k8HZ7'>

                  <i id='k8HZ7'><tr id='k8HZ7'><dt id='k8HZ7'><q id='k8HZ7'><span id='k8HZ7'><b id='k8HZ7'><form id='k8HZ7'><ins id='k8HZ7'></ins><ul id='k8HZ7'></ul><sub id='k8HZ7'></sub></form><legend id='k8HZ7'></legend><bdo id='k8HZ7'><pre id='k8HZ7'><center id='k8HZ7'></center></pre></bdo></b><th id='k8HZ7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='k8HZ7'><tfoot id='k8HZ7'></tfoot><dl id='k8HZ7'><fieldset id='k8HZ7'></fieldset></dl></div>
                    <tbody id='k8HZ7'></tbody>
                • 本文介紹了在字符串中按下 QpushButton 時(shí)如何在 QlineEdit 中獲取文本?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我正在嘗試實(shí)現(xiàn)一個(gè)功能.我的代碼如下.

                  I am trying to implement a function. My code is given below.

                  當(dāng)用戶單擊名稱為連接"的按鈕時(shí),我想在字符串中獲取對(duì)象名稱為主機(jī)"的文本,例如主機(jī)".我怎樣才能做到這一點(diǎn)?我嘗試過(guò),但失敗了.如何實(shí)現(xiàn)這個(gè)功能?

                  I want to get the text in lineedit with objectname 'host' in a string say 'shost' when the user clicks the pushbutton with name 'connect'. How can I do this? I tried and failed. How do I implement this function?

                  import sys
                  from PyQt4.QtCore import *
                  from PyQt4.QtGui import *
                  
                  
                  class Form(QDialog):
                      def __init__(self, parent=None):
                          super(Form, self).__init__(parent)
                  
                          le = QLineEdit()
                          le.setObjectName("host")
                          le.setText("Host")
                          pb = QPushButton()
                          pb.setObjectName("connect")
                          pb.setText("Connect") 
                          layout.addWidget(le)
                          layout.addWidget(pb)
                          self.setLayout(layout)
                  
                          self.connect(pb, SIGNAL("clicked()"),self.button_click)
                  
                          self.setWindowTitle("Learning")
                  
                      def button_click(self):
                      #i want the text in lineedit with objectname 
                      #'host' in a string say 'shost'. when the user click 
                      # the pushbutton with name connect.How do i do it?
                      # I tried and failed. How to implement this function?
                  
                  
                  
                  
                  app = QApplication(sys.argv)
                  form = Form()
                  form.show()
                  app.exec_()
                  

                  現(xiàn)在如何實(shí)現(xiàn)button_click"功能?我剛剛開(kāi)始使用 pyQt!

                  Now how do I implement the function "button_click" ? I have just started with pyQt!

                  推薦答案

                  我的第一個(gè)建議是使用 Qt Designer 來(lái)創(chuàng)建你的 GUI.自己打字很糟糕,需要更多時(shí)間,而且你肯定會(huì)比 Qt Designer 犯更多的錯(cuò)誤.

                  My first suggestion is to use Qt Designer to create your GUIs. Typing them out yourself sucks, takes more time, and you will definitely make more mistakes than Qt Designer.

                  這里有一些 PyQt 教程 幫助您走上正軌.列表中的第一個(gè)是您應(yīng)該開(kāi)始的地方.

                  Here are some PyQt tutorials to help get you on the right track. The first one in the list is where you should start.

                  了解哪些方法可用于特定類的一個(gè)很好的指南是 PyQt4 類參考.在這種情況下,您將查找 QLineEdit 并看到有一個(gè) text 方法.

                  A good guide for figuring out what methods are available for specific classes is the PyQt4 Class Reference. In this case, you would look up QLineEdit and see the there is a text method.

                  回答您的具體問(wèn)題:

                  要使您的 GUI 元素可用于對(duì)象的其余部分,請(qǐng)?jiān)谒鼈兦懊婕由?self.

                  To make your GUI elements available to the rest of the object, preface them with self.

                  import sys
                  from PyQt4.QtCore import SIGNAL
                  from PyQt4.QtGui import QDialog, QApplication, QPushButton, QLineEdit, QFormLayout
                  
                  class Form(QDialog):
                      def __init__(self, parent=None):
                          super(Form, self).__init__(parent)
                  
                          self.le = QLineEdit()
                          self.le.setObjectName("host")
                          self.le.setText("Host")
                          
                          self.pb = QPushButton()
                          self.pb.setObjectName("connect")
                          self.pb.setText("Connect") 
                          
                          layout = QFormLayout()
                          layout.addWidget(self.le)
                          layout.addWidget(self.pb)
                  
                          self.setLayout(layout)
                          self.connect(self.pb, SIGNAL("clicked()"),self.button_click)
                          self.setWindowTitle("Learning")
                  
                      def button_click(self):
                          # shost is a QString object
                          shost = self.le.text()
                          print shost
                          
                  
                  app = QApplication(sys.argv)
                  form = Form()
                  form.show()
                  app.exec_()
                  

                  這篇關(guān)于在字符串中按下 QpushButton 時(shí)如何在 QlineEdit 中獲取文本?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動(dòng)后進(jìn)度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標(biāo)簽設(shè)置在固定位置,以便當(dāng)我向左或向右滾動(dòng)時(shí),yaxis 刻度標(biāo)簽應(yīng)該可見(jiàn)
                  `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時(shí)顯示進(jìn)度條?)

                  <legend id='Qr1Zt'><style id='Qr1Zt'><dir id='Qr1Zt'><q id='Qr1Zt'></q></dir></style></legend>
                • <small id='Qr1Zt'></small><noframes id='Qr1Zt'>

                  <tfoot id='Qr1Zt'></tfoot>
                    • <bdo id='Qr1Zt'></bdo><ul id='Qr1Zt'></ul>
                        <tbody id='Qr1Zt'></tbody>

                          • <i id='Qr1Zt'><tr id='Qr1Zt'><dt id='Qr1Zt'><q id='Qr1Zt'><span id='Qr1Zt'><b id='Qr1Zt'><form id='Qr1Zt'><ins id='Qr1Zt'></ins><ul id='Qr1Zt'></ul><sub id='Qr1Zt'></sub></form><legend id='Qr1Zt'></legend><bdo id='Qr1Zt'><pre id='Qr1Zt'><center id='Qr1Zt'></center></pre></bdo></b><th id='Qr1Zt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Qr1Zt'><tfoot id='Qr1Zt'></tfoot><dl id='Qr1Zt'><fieldset id='Qr1Zt'></fieldset></dl></div>
                            主站蜘蛛池模板: 色婷婷亚洲 | 久久性| 日韩首页 | 18视频在线观看男男 | 自拍偷拍中文字幕 | 免费精品视频 | 久久av一区二区三区亚洲 | 色在线播放 | 欧美色综合| 国产欧美一区二区精品性色超碰 | 亚洲天堂网在线观看 | 五月婷婷综合在线 | 黄免费网站| 国产又粗又猛又黄又爽的视频 | 免费性视频 | 日韩精品一区二区三区免费视频 | 中文在线观看免费网站 | 日本一区二区高清 | 国产成人亚洲精品自产在线 | 日韩免费一区二区三区 | 精品乱子伦一区二区三区 | 91福利在线观看 | 黄色片视频网站 | 成人欧美一区二区三区白人 | 国产欧美在线 | 中国久久久| 激情视频网址 | 免费精品 | www.在线播放 | 成人aa| 国产激情在线视频 | 一二三区视频 | 日韩黄色录像 | 谁有毛片网站 | 日韩精品极品 | 国产精品永久久久久久久久久 | 久久精品一区二区三区不卡牛牛 | 成人在线免费视频观看 | 欧美综合视频 | 婷婷综合视频 | 91丨九色丨国产在线 |