I am trying to control some equipment from panel. However with my “simple version” I get an error when trying to update the code. The issue is that I am used to using “self” to refer to other functions defined in the class. However the events functionality seems not to work that way at least naively.
from qcodes.instrument_drivers.stanford_research.SG384 import SRS_SG384 as Instr class mChild( type(Instr),type(param.Parameterized)): pass class Instr_Panel(Instr,param.Parameterized,metaclass = mChild): def __init__(self, name, address, reset=False, **kwargs): print('something') '''Inherit the SRS class parameters''' super().__init__(name, address, **kwargs) def update_frequency(self,event): '''Convert the Text to a float''' freq = float(event.new) '''Call the frequency .set() function''' self.frequency.set(freq) freq_panel = pn.widgets.TextInput(name='SRS Frequency', value='5000000') freq_panel.param.watch(update_frequency, 'value') col = pn.Column(freq_panel) col.servable() SRS = SRS_SG384_Panel(name='SRS384', address='TCPIP::192.168.1.121',timeout=.01)
When running (and updating the GUI) this I get the error:
TypeError: update_frequency() missing 1 required positional argument: ‘event’
Ultimately it would be nice to write a wrapper between panel’s parameter class and the qcodes parameters class https://qcodes.github.io/Qcodes/examples/Parameters/Parameters.html.
However, this requires modifying the panel parameters class and I’m not sure I understand the syntax of panel just yet…