Link bi-directionally the values of Slider and SpinBox controls?

0

I am trying to link two common controls in graphical interfaces, a Slider and a SpinBox. They belong to a library in Python, specifies for the Blackmagic Fusion program. The thing is, the way I'm trying seems to be overwriting the control of the spinner to the slider.

These are the events available in this library for these two elements: Slider: ValueChanged, SliderMoved, ActionTriggered, SliderPressed, SliderRelease, RangeChanged,

SpinBox: EditingFinished, ValueChanged

  # GUI 
  dlg = disp.AddWindow({'ID': 'myWin', 'WindowTitle': 'myWin', 'Geometry': [ 400, 100, 230, 400 ],},
  [  
      ui.Slider({ 'ID': 'mySlider', 'Events': { 'SliderMoved': True, 'Activated': True } }),
      ui.SpinBox({ 'ID': 'mySpinBox' }),
  ])

  itm = dlg.GetItems()

  # Actualiza el valor del Spin al mover el Slider
  def _func(ev):
      var = ev['Value']
      itm['mySpinBox'].Value = var
  dlg.On.mySlider.SliderMoved = _func

  # Actualiza la posición del Slider al cambiarel valor del Spin
  def _func(ev):
      itm['mySlider'].Value = itm['mySpinBox'].Value 
  dlg.On.mySpinBox.ValueChanged = _func
    
asked by AlbertoGZ 12.05.2018 в 12:16
source

0 answers