PyQt5 - start program

0

I have two separate script, on the one hand I have the program created in python3 which is called count.py and on the other hand I have created the GUI in PyQt5 called interface.py 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 count.py and start the created program?

 self.btnInicio.clicked.connect(???)

Any kind of function that calls the other class?

PyQt5 file interface.py

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

        self.btnIniciar.clicked.connect(self.launchScript)

    def launchScript(self):
        import proyectoFINAL 
        proyectoFINAL.mainFunction()

Python3 file contador.py

    def mainFunction():

        while(cap.isOpened()):

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

Python3 file functions.py

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 count.py and this in turn is calling the 3rd class funciones.py which is where you are going to send the video.

    
asked by Lewis 28.12.2018 в 10:42
source

0 answers