[PyQt] Open a Dialog (Qt Designer class) from QMainWindow

implor implor at gmail.com
Mon May 10 20:07:34 BST 2010


I have two .ui  filers converted with pyuic4 to python code. first I start my
MainWindow gui and then I got a button to klick so the Dialog window will
open. This do not work for me. I have been stuck for 2 days now and can't
find a solution. the link below is someone with the same problem but they
don't solve it. Or I'm I doing it all wrong? How do you draw all your gui
windows in Qt Designer and then get them to work?


http://old.nabble.com/Re:-Implementing-Qt-Designer-Widgets-in-Main-Window-and-lay-them-out-td24540054.html#a24540054
http://old.nabble.com/Re:-Implementing-Qt-Designer-Widgets-in-Main-Window-and-lay-them-out-td24540054.html#a24540054 


Here is my code anyway, hope someone have a good solution :) Thank for all
replys!:


 from PyQt4 import QtCore, QtGui
from libarylib import *
from bibgui import Ui_MainWindow
from addusergui import Ui_Dialog as AddUserGui
import sys


class mainGuiWindow(QtGui.QMainWindow):

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.connect(self.ui.pushButton_3, QtCore.SIGNAL("clicked()"),
self.addUser)



    def addUser(self):
        self.Dialog = QtGui.QWidget()
        self.adduser = AddUserGui()
        self.adduser.setupUi(self.Dialog)



if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = mainGuiWindow()
    myapp.show()
    sys.exit(app.exec_())
-- 
View this message in context: http://old.nabble.com/Open-a-Dialog-%28Qt-Designer-class%29-from-QMainWindow-tp28512693p28512693.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list