Realtime Eto Output

Hey, I really tried to get this to run, but I don’t really get what is used for what, if you had a simple slider code like this:

import Rhino
import scriptcontext
import System
import Rhino.UI
import Eto
import Eto.Drawing as drawing
import Eto.Forms as forms


class EtoFormSliderTest(forms.Dialog[bool]):
    def __init__(self):   
        super().__init__()     
        self.Title = "Sample Slider Eto Test"
        self.Padding = drawing.Padding(5)
        self.ClientSize = drawing.Size(300,50)
        self.Resizable = True
        
        self.sliderTest = forms.Slider()
        self.sliderTest.MinValue = 1
        self.sliderTest.MaxValue = 4000
        self.sliderTest.Value = 170
        
        self.sliderTest.ValueChanged += self.OnSliderValueChanged
        self.sliderLabelTest = forms.Label()
        self.sliderLabelTest.Text = str(self.sliderTest.Value)
        
        layout= forms.DynamicLayout()
        layout.AddRow(None)
        layout.AddRow(self.sliderTest)
        layout.AddRow(self.sliderLabelTest)
        
        self.Content = layout

    def OnSliderValueChanged(self,sender,e):
        self.sliderLabelTest.Text = str(self.sliderTest.Value)

        
def OpenEtoWindow():
    form = EtoFormSliderTest()
    Rhino.UI.EtoExtensions.ShowSemiModal(form, Rhino.RhinoDoc.ActiveDoc, Rhino.UI.RhinoEtoApp.MainWindow)

if __name__ == '__main__':
    OpenEtoWindow()

and you wanted to have the constantly update value as “a” output, what would you need to change?
I tried the Method in this thread but couldn’t get it to run:

Eto realtime output? - Scripting - McNeel Forum

Hi @Kamil_Olkowski ,

You need to output/update the value of a to be your slider.value from the OnSliderValueChanged event.

If you add a print statement within that definition that prints the slider.value you should see the number you are updating in realtime so you need to have your output match that number.

I’d add to the code but I’m away today, hopefully that helps get you unstuck there!

     #rest of code
    def OnSliderValueChanged(self,sender,e):
        self.sliderLabelTest.Text = str(self.sliderTest.Value)
        print(str(self.sliderTest.Value))
        global a
        a = self.sliderTest.Value
    # rest of code

I changed this part of the code and while it prints all the numbers while its upgrading it won’t change the “a” output of my python component until I close the slider, I still don’t get constant updates in grasshopper.
edit: forgot to mention, that while I execute the code and use the slider the panel i conected to the python component shows “No data was collected…”.