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

        <legend id='L4PIM'><style id='L4PIM'><dir id='L4PIM'><q id='L4PIM'></q></dir></style></legend>

        • <bdo id='L4PIM'></bdo><ul id='L4PIM'></ul>

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

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

      1. <tfoot id='L4PIM'></tfoot>

      2. 在 Python (PyQt4) 中顯示彈出窗口

        Displaying pop-up windows in Python (PyQt4)(在 Python (PyQt4) 中顯示彈出窗口)
      3. <legend id='0iXoL'><style id='0iXoL'><dir id='0iXoL'><q id='0iXoL'></q></dir></style></legend>
              <bdo id='0iXoL'></bdo><ul id='0iXoL'></ul>

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

                  <tfoot id='0iXoL'></tfoot>
                1. <small id='0iXoL'></small><noframes id='0iXoL'>

                  本文介紹了在 Python (PyQt4) 中顯示彈出窗口的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我需要知道如何在用戶單擊按鈕時彈出對話框.

                  I need to know how to be able to make a dialog pop-up when a user clicks a button.

                  我對 Python 和 PyQt/QtDesigner 都比較陌生.我只在其中使用了大約一個月,但我認為我掌握得很好.

                  I'm relatively new to both Python and PyQt/QtDesigner. I've only been using in them for about a month, but I think I have a good grasp.

                  這是我所擁有的:我在 QtDesigner 中設計的主對話框(它是應用程序的主要部分).我使用 pyuic4easy 將 .ui 轉換為 .py.

                  Here's what I have: A main dialog (which is the main part of the application), which I designed in QtDesigner. I converted the .ui to .py using pyuic4easy.

                  這就是我想要做的:在 QtDesigner 中設計一個新對話框,并以某種方式使其在用戶單擊第一個(主)對話框上的按鈕時彈出.

                  Here's what I want to do: design a new dialog box in the QtDesigner and somehow make it pop up when a user clicks a button on the first (main) dialog.

                  這是我的主對話框的代碼:

                  Here's the code for my main dialog:

                  import sys
                  from PyQt4.QtCore import *
                  from loginScreen import *
                  
                  
                  class MyForm(QtGui.QDialog):
                  
                      def __init__(self, parent=None):
                          QtGui.QWidget.__init__(self, parent)
                          self.ui = Ui_Dialog()
                          self.ui.setupUi(self)
                          QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL('clicked()'), self.popup)     
                          ...
                  
                          ... Some functions ...
                  
                     def popup(self):
                          #Pop-up the new dialog
                  
                  if __name__ == "__main__":
                     app = QtGui.QApplication(sys.argv)
                     myapp= MyForm()
                     myapp.show()
                     sys.exit(app.exec_())
                  

                  如您所見,我已將第一個按鈕連接到一個名為popup"的方法,該方法需要填寫代碼以使我的第二個窗口彈出.我該怎么做呢?請記住,我已經在 QtDesigner 中設計了第二個對話框,我不需要創建新的.

                  So as you can see, I've connected the first button to a method named 'popup', which needs to be filled in with code to make my second window pop up. How do I go about doing this? Remember that I already have designed my second dialog in QtDesigner, and I don't need to create a new one.

                  感謝大家的幫助!

                  推薦答案

                  如您所見,我已將第一個按鈕連接到名為'popup',需要填寫代碼才能使我的第二個彈出窗口.我該怎么做?

                  So as you can see, I've connected the first button to a method named 'popup', which needs to be filled in with code to make my second window pop up. How do I go about doing this?

                  與主窗口 (MyForm) 的操作方式幾乎相同.

                  Pretty much the same way you do it for your main window (MyForm).

                  像往常一樣,您為第二個對話框的 QtDesigner 代碼編寫一個包裝類(就像您對 MyForm 所做的那樣).我們稱之為MyPopupDialog.然后在您的 popup 方法中,您創建一個實例,然后使用 exec_()show() 顯示您的實例,具體取決于您是否想要模態或非模態對話框.(如果不熟悉 Modal/Modeless 的概念,可以參考 文檔.)

                  As usual, you write a wrapper class for your QtDesigner code for the second dialog (like you did with MyForm). Let's call it MyPopupDialog. Then in your popup method, you create an instance and then show your instance with either exec_() or show() depending whether you want a modal or modeless dialog. (If you are not familiar with Modal/Modeless concept, you might refer to the documentation.)

                  所以整體可能看起來像這樣(有一些修改):

                  So the overall thing might look like this (with a couple of modifications):

                  # Necessary imports
                  
                  class MyPopupDialog(QtGui.QDialog):
                      def __init__(self, parent=None):
                          # Regular init stuff...
                          # and other things you might want
                  
                  
                  class MyForm(QtGui.QDialog):
                      def __init__(self, parent=None):
                          # Here, you should call the inherited class' init, which is QDialog
                          QtGui.QDialog.__init__(self, parent)
                  
                          # Usual setup stuff
                          self.ui = Ui_Dialog()
                          self.ui.setupUi(self)
                  
                          # Use new style signal/slots
                          self.ui.pushButton.clicked.connect(self.popup)     
                  
                          # Other things...
                  
                     def popup(self):
                          self.dialog = MyPopupDialog()
                  
                          # For Modal dialogs
                          self.dialog.exec_()
                  
                          # Or for modeless dialogs
                          # self.dialog.show()
                  
                  if __name__ == "__main__":
                     app = QtGui.QApplication(sys.argv)
                     myapp= MyForm()
                     myapp.show()
                     sys.exit(app.exec_())
                  

                  這篇關于在 Python (PyQt4) 中顯示彈出窗口的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 - 自動更改角色顏色)

                  • <small id='i6BS8'></small><noframes id='i6BS8'>

                        <bdo id='i6BS8'></bdo><ul id='i6BS8'></ul>
                            <tbody id='i6BS8'></tbody>

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

                          • 主站蜘蛛池模板: 精品av久久久久电影 | zzzwww在线看片免费 | 国产精品视频在线免费观看 | 久久一级 | 亚洲激情视频在线 | 国产精品视频 | 台湾av在线| 久久国产精品偷 | 国产激情一区二区三区 | 91欧美精品成人综合在线观看 | 国产一区二区精品在线观看 | 欧美一区二区三区视频在线 | 久久久久国产精品一区二区 | 亚洲综合精品 | 成人h动漫亚洲一区二区 | 亚洲国产精品一区二区三区 | 一区二区三区四区视频 | 精品久久一 | 成人午夜视频在线观看 | 久久99精品国产99久久6男男 | 久久这里只有精品首页 | 国产视频一区二区 | 国产精品视频久久 | 国产精品99久久免费观看 | 日韩欧美二区 | 国产精品免费一区二区三区四区 | 国产一区二区 | 久草精品视频 | 在线日韩精品视频 | 国产精品久久久久久网站 | 欧美日韩亚洲视频 | 欧美日韩亚洲国产综合 | 日韩不卡在线 | 伊人免费观看视频 | 婷婷丁香在线视频 | 中文字幕一区二区三 | 亚洲精品久久久一区二区三区 | 欧美精品久久久久久久久久 | 国产精品久久久久无码av | 一本一道久久a久久精品蜜桃 | 国产精品日日摸夜夜添夜夜av |