PyQt5 - start program


I have two separate script, on the one hand I have the program created in python3 which is called and on the other hand I have created the GUI in PyQt5 called with the functionalities that I need.

My question is this:

How can I do so that the moment I click on the "Start" button of the interface, connect with and start the created program?


Any kind of function that calls the other class?

PyQt5 file

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.resize(582, 484)
        self.centralwidget = QtWidgets.QWidget(MainWindow)


    def launchScript(self):
        import proyectoFINAL 

Python3 file

    def mainFunction():


        grabbed, frame = redimensiona_frame()
        if grabbed == True:
            text = "Carretera sin vehiculos"
        elif grabbed == False:
            print("Video finalizado")

Python3 file

with open ('C:/PROYECTO FINAL/configuracion.txt', encoding = 'utf-8') as a_file:
    rutaVideo = a_file.readline().strip()
    param = a_file.readline().strip()
    param2 = a_file.readline().strip()
    param3 = a_file.readline().strip()   

cap = cv2.VideoCapture(rutaVideo)

Here I leave some code of how the program is more or less structured. Basically I want to press the "start" button and have the video that I have loaded which is running the algorithm open in class and this in turn is calling the 3rd class which is where you are going to send the video.

asked by Lewis 28.12.2018 в 10:42

0 answers