Wanderson-Magalhaes / Simple_PySide_Base

MIT License
752 stars 183 forks source link

How to define AppFunctions(MainWindow) #16

Open KevinPatel04 opened 3 years ago

KevinPatel04 commented 3 years ago

@Wanderson-Magalhaes I would like to create custom functions. Can you write a sample code for declaring the function in AppFunction and pass the MainWindow object because I have tried but not able to open QMessageBox and QFileDialog using the app functions.

Egyras commented 2 years ago

@KevinPatel04 did you figured out ? I also made a circular progress bar in Qt designer in main window and cant make it work.....

bpanneton commented 2 years ago

@KevinPatel04 @Egyras

I was able to use something like this:

In app_functions.py:

class Functions(MainWindow):
    def test_function(self):
        print('Test')

And in main.py

self.ui.button.clicked.connect(lambda: Functions.test_function(self))

Hopefully that helps!