filmov
tv
Calculate with two QSliders values using PyQt5 [closed]

Показать описание
Below, you can find the text related to the question/problem. In the video, the question will be presented first, followed by the answers. If the video moves too fast, feel free to pause and review the answers. If you need more detailed information, you can find the necessary sources and links at the bottom of this description. I hope this video has been helpful, and even if it doesn't directly solve your problem, it will guide you to the source of the solution. I'd appreciate it if you like the video and subscribe to my channel!Calculate with two QSliders values using PyQt5 [closed]
i am learning to use PyQt5 and one function that can be useful to me is sliders/dials value that i can calculate with an other (for example, i am working on a python app to calculate coil inductance).
But all the tutorials i've found that far online, are simple codes to display on a label.
Generally it looks like this :
from PyQt5.QtWidgets import QMainWindow, QApplication, QSlider, QLabel
from PyQt5 import uic
import sys
class UI(QMainWindow):
def __init__(self):
super(UI,self).__init__()
# Load the ui file
#define widgets
# Slider properties
# Move the slider
#show the App
def slide_it(self, value):
#Initialize the app
UIWindow = UI()
from PyQt5.QtWidgets import QMainWindow, QApplication, QSlider, QLabel
from PyQt5 import uic
import sys
class UI(QMainWindow):
def __init__(self):
super(UI,self).__init__()
# Load the ui file
#define widgets
# Slider properties
# Move the slider
#show the App
def slide_it(self, value):
#Initialize the app
UIWindow = UI()
I understand we connect the only value on the slide_it function. But how do we hook up 2 values for example ?
like : how can i grab the 'int' value of the slider ? and use it to calculate ?
i tried this :
#show the App
def slide_it(self, value, value2):
#show the App
def slide_it(self, value, value2):
I was expecting it to take slide 1 on value and slider 2 on value2.
But it returns :
TypeError: UI.slide_it() missing 1 required positional argument: 'value2'
TypeError: UI.slide_it() missing 1 required positional argument: 'value2'
insted of
i tried
# or
# for example adding directly both valSource of the question:
Question and source license information: