久久久久久久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>
                          • 主站蜘蛛池模板: 四虎海外| 日韩一二区 | 国产精品一区二区久久 | 成人久久久 | 天天躁日日躁狠狠躁白人 | 亚洲一区二区久久 | 999免费网站 | 亚洲综合在线一区二区 | 视频二区国产 | 久久精品亚洲精品国产欧美 | 国产清纯白嫩初高生在线播放视频 | 在线不卡一区 | 国产视频三区 | www.国产精品| 久久成人一区 | 久久久久一区 | 日韩av啪啪网站大全免费观看 | 国产精品69毛片高清亚洲 | 国产激情一区二区三区 | 国产h视频 | 精品三区| 亚洲国产精品一区二区久久 | 四虎影院在线观看免费视频 | 久久网站免费视频 | 精品欧美乱码久久久久久 | 国产成人精品一区二区在线 | 羞羞视频免费观看入口 | 成人免费一区二区三区牛牛 | 成年免费大片黄在线观看岛国 | 久草精品视频 | 精品1区2区3区4区 | 久久久久国产精品一区二区 | 成人1区2区| 国产不卡在线观看 | 国产一区二区三区网站 | 福利视频三区 | 中文字幕乱码视频32 | 玖玖视频网| 日本a视频 | 一a级片 | 欧美在线观看一区二区 |