By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,882 Members | 2,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,882 IT Pros & Developers. It's quick & easy.

PyQt: how to open a dialog made in designer

P: 17
So ive got a bit of a problem here. Ive been searching the net about this for quite some time now but i just cant seem to figure out how to open a dialog that ive made in QtDesigner.
Of corse i used pyuic4 to make it into python code.

This is the code for my dialog window(it contains just a TextEdit and a LineEdit):
Expand|Select|Wrap|Line Numbers
  1. from PyQt4 import QtCore, QtGui
  2.  
  3. class Ui_Dialog(object):
  4.     def setupUi(self, Dialog):
  5.         Dialog.setObjectName("Dialog")
  6.         Dialog.resize(QtCore.QSize(QtCore.QRect(0,0,400,283).size()).expandedTo(Dialog.minimumSizeHint()))
  7.  
  8.         self.textEdit = QtGui.QTextEdit(Dialog)
  9.         self.textEdit.setGeometry(QtCore.QRect(13,14,381,231))
  10.         self.textEdit.setObjectName("textEdit")
  11.  
  12.         self.lineEdit = QtGui.QLineEdit(Dialog)
  13.         self.lineEdit.setGeometry(QtCore.QRect(20,250,371,27))
  14.         self.lineEdit.setObjectName("lineEdit")
  15.  
  16.         self.retranslateUi(Dialog)
  17.         QtCore.QMetaObject.connectSlotsByName(Dialog)
  18.  
  19.     def retranslateUi(self, Dialog):
  20.         Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
So how would i go about to get this dialog to show?
I've tried this method here beneather. It doesnt produce any errors, but the dialog doesnt appear eather.

Expand|Select|Wrap|Line Numbers
  1. def openDialog(self):
  2.     window = QtGui.QDialog()
  3.     d = TestDialog()
  4.     d.setupUi(window)
  5.     window.show()
Thanks for your help guys
Mar 4 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.