1 Attachment(s)
[SOLVED]How to connect different UI files
image : Attachment 11368
Im trying to connect different Qt Dialogs using PyQt , but I can't figure out how to do that.
In my example, "dialog_inserir.ui" will be main window, so when I click "say hello !" button, the second window will appear.
How to do that in Python Qt code ?
The code im trying :
Code:
import dialog_inserir as di # the first window of image
import hello as hl # the "hello world" window
import sys
from PyQt4 import QtGui, QtCore
def __init__(self, parent=None):
QtGui.
QWidget.__init__
(self, parent
) self.ui = di.Ui_Dialog()
self.ui.setupUi(self)
QtCore.
QObject.
connect(self.
ui.
pushButtonSayHello, QtCore.
SIGNAL('clicked()'), self.
Hello)
def Hello(self):
# ... what here ? ...
pass
def __init__(self, parent=None):
QtGui.
QWidget.__init__
(self, parent
) self.helloui = hl.Ui_Dialog()
self.helloui.setupUi(self)
if __name__ == "__main__":
mywindow = MainWindow()
mywindow.show()
sys.exit(app.exec_())
Re: How to connect different UI files
probably something like this
Code:
def Hello(self):
helloWindow = HelloWindow(self)
helloWindow.show()
pass
Cheers,
_
Re: How to connect different UI files
Oh thanks, I was missing the second 'self' arg !