I am interested in making a seemingly simple RGB color controller that includes a control dial, 3 sliders for the different colors and 3 LCD numbers all in the Qt designer interface.
The dial points to places on a color wheel and I made the range of points around the dial to be from 0 to 360 so that Blue, Green, and Red maximums (red at maximum strength with blue and green outputting no color would give only red) occur at 0, 120, and 240 respectively.
The sliders take an input of an integer that the dial outputs.
I am wondering how I could make a slider start taking information at a point on the control dial and have the slider go up and down as it approached and retreated from that slider's maximum.
I was also wondering if there is a way to relate the control dial's output to the slider's input as a fraction (if the control dial point was 6, the slider's point would be 3).
Any thoughts on how this could be done or an easier way to go about the whole thing would be great!
This program has a dialer and a spin box in it. The dialer value is connected with a method which is passed the actual value of the dialer. Once the method receives this value, it goes ahead and does some operation in it (in this case halves it), and then passes the values to the spinbox value.
import PySide.QtCore as QtCore import PySide.QtGui as QtGui import sys class MainWindow(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self) dial = QtGui.QDial() dial.setNotchesVisible(True) self.spinbox = QtGui.QSpinBox() layout = QtGui.QHBoxLayout() layout.addWidget(dial) layout.addWidget(self.spinbox) self.setLayout(layout) #connect this event to the given method. dial.valueChanged.connect(self.changeSpinbox) def changeSpinbox(self, value): #do some operation on this value. In this case half it. self.spinbox.setValue(value / 2) app = QtGui.QApplication(sys.argv) main_window = MainWindow() main_window.show() app.exec_()