Open a dialog from MainWindow - pyQT4 - Beginner :-)

  • Thread starter Florian Wollenschein
  • Start date
F

Florian Wollenschein

Dear folks,

I'm just working on a pyQT4 version of my txt to html converter thc (see
listick.org for details).

I created the MainWindow with QT Designer and then converted it to .py
with pyuic4. It works well so far. Then I created a new UI for my
abtDialog (about dialog for my application). I did the same as with the
MainWindow, so I have two UIs and two *_ui.py files now. How can I open
the dialog from my main application class?

Here's part of the code I'm using:

....
self.connect(self.actionAbout,
QtCore.SIGNAL("triggered()"), self.OpenAbout)
....
def OpenAbout(self):
pass
....

The OpenAbout function should open the dialog. I've already tried a
abtDialog.show() after creating it via abtDialog = ThcAboutDialog()
(ThcAboutDialog is the class for this dlg).

Any ideas?

Thanks,
Listick Lorch
http://www.listick.org

PS: Keep in mind that I'm quite a beginner in the field of python and qt...
 
N

nickgaens

Dear folks,

I'm just working on a pyQT4 version of my txt to html converter thc (see
listick.org for details).

I created the MainWindow with QT Designer and then converted it to .py
with pyuic4. It works well so far. Then I created a new UI for my
abtDialog (about dialog for my application). I did the same as with the
MainWindow, so I have two UIs and two *_ui.py files now. How can I open
the dialog from my main application class?

Here's part of the code I'm using:

...
self.connect(self.actionAbout,
                 QtCore.SIGNAL("triggered()"), self.OpenAbout)
...
  def OpenAbout(self):
         pass
...

The OpenAbout function should open the dialog. I've already tried a
abtDialog.show() after creating it via abtDialog = ThcAboutDialog()
(ThcAboutDialog is the class for this dlg).

Any ideas?

Thanks,
Listick Lorchhttp://www.listick.org

PS: Keep in mind that I'm quite a beginner in the field of python and qt....

def OpenAbout(self):
# don't forget to connect the "Ok"-button of this about-dialog to
QDialog::accept() ;-)
abtDialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
abtDialog.exec_()

R3

ps: you could take a look at a QMessageBox::information or so to make
this more "simple"
 
F

Florian Wollenschein

def OpenAbout(self):
# don't forget to connect the "Ok"-button of this about-dialog to
QDialog::accept() ;-)
abtDialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
abtDialog.exec_()

R3

ps: you could take a look at a QMessageBox::information or so to make
this more "simple"

Wow, thanks for your help. Now it's working :)

Great.
Regards,
Listick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top