Python - Pop up window with wait message. Qt, Pyside

0

I have a program with an interface made with Qt, Pyside.

After completing the fields of the interface the program performs actions that take a while.

What I would like is to put a pop-up window with a message and that does not let the user touch anything of the program and when the program finishes performing its actions that another window appears with a close button. This window with the close button I already have it.

What I need is to know how I can open a pop-up window that closes itself when the process is finished and that does not let the user touch anything while it's open.
I have seen the QProgressDialog and the QProgressBar, but I want something very simple that only shows a message.

def funcion_que_tarda_un_minuto():
    ...
    ...
    #aquí abrir la ventana pop up con un mensaje "espera mientras se realizan los cálculos" y que no deje al usuario hacer nada en el programa

    #Una vez terminados los cálculos, esta ventana se cierra sola y aparece al instante otra con:
    self.msgBox = QMessageBox
    self.msgBox = setIcon(QMessageBox.Information)
    self.msgBox = setText("Proceso finalizado")
    self.retval = self.msgBox.exec_()

Greetings and thanks

    
asked by Tercuato 15.02.2018 в 08:53
source

1 answer

0

This is quite complicated: you must process the information in another thread or process. With threads, you can use signals to communicate the process term.

A good starting point is the mandelbrot example :

def función_que_tarda_un_minuto():
    # …
    return True

class Trabajador(QThread):
    terminado = pyqtSignal()
    # …
    def run(self):
        # esto se ejecuta en otro hilo
        función_que_tarda_un_minuto()
        self.terminado.emit()

class MiWidget(QWidget):
    # …
    def desplegar_cuadro_terminado(self):
        msg_box = QMessageBox()
        # …
        msg_box.exec_()

    def correr_cálculos(self):
        trabajador = Trabajador()
        trabajador.terminado.connect(self.desplegar_cuadro_terminado)
        trabajador.start()
    
answered by 21.03.2018 в 14:33