Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to access spinbox value in another class in a different .py file to the main window file?



  • I have three .py files. The first file has my main window class where I setup my UI from the second .py file which I generate from Qt Designer. This UI includes a QSpinBox. My third .py file includes a class to control a stepper motor. I am trying to setup a variable in my stepper motor class which is the value of the spin box, as I'd like to use this for the number of steps the motor takes. I can access the spin box value no problem in my main window file but not my stepper motor file? Is there a way this can be done without me having to move my stepper motor class into the same .py file as my main window? I'd like to keep them separate as I want to have different .py files for each piece of equipment so that the main window py file doesn't end up crowded.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show your code ?

    Where exactly are you using your stepper motor control class ?


Log in to reply