Run code after the QtDialog shows

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Run code after the QtDialog shows

starglider.dev
Hi,
I need to "emulate" a terminal and need to automaticly run the code after
the QDialog shows and close the QDialog after it ends the task.
How can I do that, the best I made was this:

class ConsoleClass(QDialog): ...

def main():
 app = QApplication(sys.argv)
    main.form = ConsoleClass()
   
    main.form.show()
    app.processEvents()

main()


It works fine

_______________________________________________
PyQt mailing list    [hidden email]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Run code after the QtDialog shows

starglider.dev
Sorry gmail send it automatic.

Hi,
I need to "emulate" a terminal and need to automaticly run the code after
the QDialog shows and close the QDialog after it ends the task.
The best I find was this:

class ConsoleClass(QDialog): ...

def main():
    app = QApplication(sys.argv)
    main.form = ConsoleClass()
   
    main.form.show()
    app.processEvents()
    run_my_code()

main()


It works fine, but if I call it from a another form it closes all the application.

How can I prevent the main application to be closed?

Thank you in advance for your help.

zorze

_______________________________________________
PyQt mailing list    [hidden email]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt