Dear fusion fellows,
I'm creating a very basic UI in daVinci resolve Script, using python.
So far I stole a piece of code which creates a slider in python:
- Code: Select all
ui = fu.UIManager
disp = bmd.UIDispatcher(ui)
dlg = disp.AddWindow({ "WindowTitle": "My First Window", "ID": "MyWin", "Geometry": [ 100, 100, 400, 100 ], },
[
ui.HGroup({ "Spacing": 0, },
[
ui.Slider({ "ID": "MySlider", }),
ui.Label({ "ID": "MyLabel", "Text": "Value:", }),
]),
])
itm = dlg.GetItems()
def _func(ev):
disp.ExitLoop()
dlg.On.MyWin.Close = _func
itm['MySlider'].Value = 25
itm['MySlider'].Minimum = 0
itm['MySlider'].Maximum = 100
def _func(ev):
itm['MyLabel'].Text = "Slider Value: " + str(ev['Value'])
print("Slider Value: " + str(ev['Value']))
dlg.On.MySlider.ValueChanged = _func
dlg.Show()
disp.RunLoop()
dlg.Hide()
Now I want to add a button which once clicked on starts the process (say process.exe) and reads its output.
Naturally, I add:
- Code: Select all
ui.Button({ "ID": 'Button1', "Flat": "true",}),
into ui.HGroup.
Now I need to attach the function to this button.
In lua this is achieved trivially. We simply add the function:
- Code: Select all
function win.On.Button1.Clicked(ev)
f = io.popen(path_to_exe0)
path = f:read("*a")
end
How do I achieve the same in Python? Do you know where I can steal some examples?
Yaroslav.