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

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

    <small id='3Z5w3'></small><noframes id='3Z5w3'>

    <tfoot id='3Z5w3'></tfoot>

        <legend id='3Z5w3'><style id='3Z5w3'><dir id='3Z5w3'><q id='3Z5w3'></q></dir></style></legend>
      1. 在 PyQt 中打開第二個窗口

        Open a second window in PyQt(在 PyQt 中打開第二個窗口)

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

            <bdo id='OfMfb'></bdo><ul id='OfMfb'></ul>
            1. <legend id='OfMfb'><style id='OfMfb'><dir id='OfMfb'><q id='OfMfb'></q></dir></style></legend>

                1. <small id='OfMfb'></small><noframes id='OfMfb'>

                  <tfoot id='OfMfb'></tfoot>

                    <tbody id='OfMfb'></tbody>
                  本文介紹了在 PyQt 中打開第二個窗口的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試使用 pyqt 在單擊 QMainWindow 上的按鈕時顯示自定義 QDialog 窗口.我不斷收到以下錯誤:

                  I'm trying to use pyqt to show a custom QDialog window when a button on a QMainWindow is clicked. I keep getting the following error:

                  $ python main.py 
                  DEBUG: Launch edit window
                  Traceback (most recent call last):
                    File "/home/james/Dropbox/Database/qt/ui_med.py", line 23, in launchEditWindow
                      dialog = Ui_Dialog(c)
                    File "/home/james/Dropbox/Database/qt/ui_edit.py", line 15, in __init__
                      QtGui.QDialog.__init__(self)
                  TypeError: descriptor '__init__' requires a 'sip.simplewrapper' object but received a 'Ui_Dialog'
                  

                  我已經閱讀了幾個在線教程,但其中大多數都沒有展示如何使用非內置對話窗口.我使用 pyuic4 為主窗口和對話框生成了代碼.我認為應該是相關代碼如下.我在這里錯過了什么?

                  I've gone over several online tutorials, but most of them stop just short of showing how to use a non built-in dialog window. I generated the code for both the main window and the dialog using pyuic4. What I think should be the relevant code is below. What am I missing here?

                  class Ui_Dialog(object):
                      def __init__(self, dbConnection):
                          QtGui.QDialog.__init__(self)
                          global c
                          c = dbConnection
                  
                  class Ui_MainWindow(object):
                      def __init__(self, dbConnection):
                          global c
                          c = dbConnection
                  
                      def launchEditWindow(self):
                          print "DEBUG: Launch edit window"
                          dialog = QtGui.QDialog()
                          dialogui = Ui_Dialog(c)
                          dialogui = setupUi(dialog)
                          dialogui.show()
                  
                  class StartQT4(QtGui.QMainWindow):
                      def __init__(self, parent=None):
                          QtGui.QWidget.__init__(self, parent)
                          conn = sqlite3.connect('meds.sqlite')
                          c = conn.cursor()
                          self.ui = Ui_MainWindow(c)
                          self.ui.setupUi(self)
                  
                  def main():
                      app = QtGui.QApplication(sys.argv)
                      program = StartQT4()
                      program.show()
                      sys.exit(app.exec_())
                  
                  if __name__ == '__main__':
                      main()
                  

                  額外的問題:因為看起來你不能在 pyqt 函數回調中傳遞參數,所以將一些本來可以作為參數傳遞的東西(名稱不佳的c")設置為全局,這是獲取信息的最佳方式那些功能?

                  Bonus question: since it looks like you can't pass arguments in pyqt function callbacks, is setting something which would otherwise be passed as an argument (the poorly named "c") to be global the best way to get information into those functions?

                  推薦答案

                  我過去做過這樣的事情,我可以說它有效.假設您的按鈕被稱為按鈕"

                  I've done like this in the past, and i can tell it works. assuming your button is called "Button"

                  class Main(QtGui.QMainWindow):
                      ''' some stuff '''
                      def on_Button_clicked(self, checked=None):
                          if checked==None: return
                          dialog = QDialog()
                          dialog.ui = Ui_MyDialog()
                          dialog.ui.setupUi(dialog)
                          dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
                          dialog.exec_()
                  

                  這適用于我的應用程序,我相信它也應該適用于您的應用程序.希望它會有所幫助,應該非常直接地進行一些更改以將其應用于您的案例.祝大家有個美好的一天.

                  This works for my application, and I believe it should work with yours as well. hope it'll help, it should be pretty straight forward to do the few changes needed to apply it to your case. have a good day everybody.

                  這篇關于在 PyQt 中打開第二個窗口的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

                  1. <small id='h74QQ'></small><noframes id='h74QQ'>

                    <tfoot id='h74QQ'></tfoot>

                    • <i id='h74QQ'><tr id='h74QQ'><dt id='h74QQ'><q id='h74QQ'><span id='h74QQ'><b id='h74QQ'><form id='h74QQ'><ins id='h74QQ'></ins><ul id='h74QQ'></ul><sub id='h74QQ'></sub></form><legend id='h74QQ'></legend><bdo id='h74QQ'><pre id='h74QQ'><center id='h74QQ'></center></pre></bdo></b><th id='h74QQ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='h74QQ'><tfoot id='h74QQ'></tfoot><dl id='h74QQ'><fieldset id='h74QQ'></fieldset></dl></div>
                      • <bdo id='h74QQ'></bdo><ul id='h74QQ'></ul>
                        <legend id='h74QQ'><style id='h74QQ'><dir id='h74QQ'><q id='h74QQ'></q></dir></style></legend>
                          <tbody id='h74QQ'></tbody>
                          • 主站蜘蛛池模板: 欧美 日韩 亚洲91麻豆精品 | 中文字幕欧美一区 | 日本亚洲一区二区 | 国产成人免费视频网站高清观看视频 | www.日韩高清| 午夜精品一区 | 91久久久久 | 天天躁日日躁狠狠的躁天龙影院 | 99精品99久久久久久宅男 | 国产精品日日做人人爱 | www..com18午夜观看 | 国产成人精品福利 | 中文字幕av在线一二三区 | 国产高清在线 | 一级a性色生活片久久毛片 一级特黄a大片 | 天天操天天干天天爽 | 一区二区在线不卡 | 8x国产精品视频一区二区 | 欧美xxxx性xxxxx高清 | 一区二区三区日韩 | 久久久久久国模大尺度人体 | 欧美一级在线视频 | 一区二区三区免费在线观看 | 91免费观看国产 | av在线电影网| 97视频在线观看网站 | 综合色久 | 成人高清视频在线观看 | 中文字幕一区二区三区精彩视频 | 人人叉 | 欧美性久久 | 99久久精品免费看国产四区 | 亚洲视频在线看 | 中文在线a在线 | 99精品国产一区二区三区 | 免费成人高清 | 日韩免费视频 | 日韩欧美中文在线 | 欧美久久久久久久久 | 欧洲高清转码区一二区 | 日韩精品一区二区三区老鸭窝 |