I have following code to display current output form Oscilloscope. To update the graph I have to constantly press a button "CH1". What would be the best way to update the graph automatically?
Should I use a timer, but I think it may freeze the PC.
I have following code to display current output form Oscilloscope. To update the graph I have to constantly press a button "CH1". What would be the best way to update the graph automatically?
Should I use a timer, but I think it may freeze the PC.
I am not a big expert of GUI interfaces, but from the button you call an action:
self.ch1button = wx.Button(self.panel, -1, "CH1")
self.Bind(wx.EVT_BUTTON, self.on_ch1_button, self.ch1button)
def on_ch1_button(self, event):
self.data = inst.get_data("CHANnnel1")
self.time = inst.get_xdata()
self.draw_figure()
Easy way would be to call that function periodically --> Every second you just call on_ch1_button.
Better way is to initialize a thread that is doing that for you until the program stops in background. More information on thread you can find in stackoverflow :-)
Hope this can help a bit! Have a nice day!
I have the solution with vispy and pyqt if someone is interested :) I'm quite new to SO and I don't want to pollute this wx and matplotlib post with a lot of code not directly related, but if someone needs it I'll edit my answer and post it here! Just tell me :)