I want to be able to call and run an executable in a separate thread so when running it the Python GUI application does not freeze up.
I'm not sure how to do this.
I have a single button on my gui form for testing called buttonLaunch which when clicked will call a module named 'Launch'. My sample code is below. How can I get the executable to run in separate thread?
guess I should have searched a bit harder. I was able to use subprocess.Popen(executabe here)
I'm not sure how to do this.
I have a single button on my gui form for testing called buttonLaunch which when clicked will call a module named 'Launch'. My sample code is below. How can I get the executable to run in separate thread?
#!/usr/bin/python3 #OoeyGUI MESS v2.0 #Copyright 2015 - 2019 #Chris Schneider [SHIFT838] #http://shift838.99er.net import os import os.path import sys import subprocess import serial.tools.list_ports import xml.etree.ElementTree as ET import platform from PyQt5.QtCore import QThread, pyqtSignal from PyQt5 import QtCore, QtGui, QtWidgets, QtSerialPort, uic from PyQt5.QtWidgets import QFileDialog, QMessageBox, QInputDialog, QLineEdit from os import path LOCAL_DIR = os.path.dirname(os.path.realpath(__file__)) + "/" class Main(QtWidgets.QMainWindow): def __init__(self): super().__init__() self.ui = uic.loadUi(LOCAL_DIR + "test.ui", self) self.ui.buttonLaunch.clicked.connect(self._Launch) self.show() def _Launch(self, clicked): os.system("java -jar c:/tiimagetool/tiimagetool.jar") if __name__ == '__main__': ogv = "2.0 BETA Build 012919" app = QtWidgets.QApplication([]) gui = Main() gui.setWindowTitle("OoeyGUI Mess v" + ogv) gui.show() sys.exit(app.exec_())
guess I should have searched a bit harder. I was able to use subprocess.Popen(executabe here)