How to pass argument to user defined function in Qprocess

Heads up! You've already completed this tutorial.

Ganesh_Gupta | 2021-02-22 14:36:13 UTC | #1

python
    def calc(self):
        progressBar = self.progressBar
        self.Calculate.setEnabled(False)
        filter = self.SubSectorLevel1.currentText()
        filter1 = self.SubSectorLevel2.currentText()
        IND = self.lineEdit.text()
        OTD = self.lineEdit_2.text()
        Version= self.lineEdit_10.text()
        Year=self.lineEdit_4.text()
        if filter=='Residue Burning':
            if filter1 =='None':
                ARB(IND,OTD,Version,Year,progressBar)
        if filter=='Lightning & Heating':
            if filter1 =='Lighting':
                RKL(IND,OTD,Version,Year)
            elif filter1=='Space Heating':
                RSH(IND,OTD,Version,Year)
            elif filter1=='Water Heating':
                RWH(IND,OTD,Version,Year,progressBar)
        if filter=='Brick Production':
            if filter1 =='None':
                BP(IND,OTD,Version,Year,progressBar)

I want to use Qprocess in user defined function like RSH and BP


Eolinwen | 2021-02-19 18:50:30 UTC | #2

Hi Ganesh_Gupta Your code is not very clear and readable.


martin | 2021-05-30 15:29:34 UTC | #3

Hi @Ganesh_Gupta welcome to the forum. I've edited the code to make it clearer, but I'm still not sure what you're trying to do.

If you're wanting to run those functions (RKL, etc.) concurrently, it probably makes sense to use threads. If you take a look at the bottom of the threading tutorial there is an example where you can pass a custom function to run on a separate thread.

The complete guide to packaging Python GUI applications with PyInstaller.
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]


Ganesh_Gupta | 2021-05-30 15:30:25 UTC | #4

Create GUI Applications with Python & Qt6 by Martin Fitzpatrick — (PyQt6 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!

More info Get the book

Hi Martin, Thank you for your response. I solved this problem in different way but i have another query which i posted on different thread.

PyQt/PySide 1:1 Coaching with Martin Fitzpatrick — Get one on one help with your Python GUI projects. Working together with you I'll identify issues and suggest fixes, from bugs and usability to architecture and maintainability.

Book Now 60 mins ($195)


Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak
Martin Fitzpatrick

How to pass argument to user defined function in Qprocess was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt. Martin founded PythonGUIs to provide easy to follow GUI programming tutorials to the Python community. He has written a number of popular https://www.martinfitzpatrick.com/browse/books/ on the subject.