Python Forum
[PyQt] Signals and slots, transcending classes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Signals and slots, transcending classes
#1
Hi,

I'm new to Python, and using QT to create a UI and am consequently using PyCharm to connect slots and signals.

In PyCharm I have the control parameters module. And was using it to pass away values to parameters so I can use those to do math outside the module. Looking something like this.

        Parameter1 = 0
        Parameter2 = 0
        Parameter3 = 0

        self.retranslateUi(Control_Parameters)
        self.CurrentControl.sliderMoved['int'].connect(self.label_5.setNum)
        Parameter1 = self.CurrentControl.sliderMoved['int']
        Parameter1.connect(self.label_3.setNum)
        Parameter2 = self.ShiftOPP.sliderMoved['int']
        Parameter3 = Parameter2 // wanted math here not possible
        self.retranslateUi(Control_Parameters)
        Parameter3.connect(self.label_4.setNum)
        # self.ShiftOPP.sliderMoved['int'].connect(self.Parameter2)
        # self.ShiftOPP.sliderMoved['int'].connect(self.Parameter2)
        self.Offset.sliderMoved['int'].connect(self.label_4.setNum)
My problem is tho, I cant seem to do math inside the module, and whenever I try to reference the variables outside the main module I get an error. Is it possible to take them somewhere else where I can do integer arithmetic with the signals? "Not necessarily setting number boxes (passing integers), but preferrably not limitted to.


Kind Regards,
Reply
#2
Okay that is not a MRE (Minimal Reproducible Example) so it will be very difficult to determine what you are doing and thus very difficult to answer your question. You will get a much quicker response if you include a completely functional bit of code that allows one to copy/paste and run it to see what you are doing. Also are you using just QT or PyQt and/or are you using some kind of Designer the latter btw while based on Qt/PyQt does not actually produce Qt/PyQt code. Once you see a true version of the former you will understand why I say that about the latter.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] Connecting pushbuttons signals throug a lambda fonction in a loop arbiel 4 2,428 Nov-05-2020, 06:37 PM
Last Post: arbiel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020