Dear all passionated programmers,
I am programming an GUI to investigate my data. Those data is displayed in a 3D plot on a panel. The Plot is filling a prepared FigureCanvas on my GUI by the time I hit a Button. The Plot function gathers some parameter information from my Interface and is created. I want to automate the process by enabling the function to always create a new plot when a parameter is changed.
I am more than helpless right now. Maybe there is something I am missing. Is there some module that I can use ? Or is there a common way of doing something like that:
class MainFrame(wx.Frame):
def __init__(self, *args, **kwargs):
super(MainFrame, self).__init__(*args, **kwargs)
self.InitUI()
self.Show(True)
def InitUI(self):
print __doc__
self.figure1 = Figure(figsize=(1,1))
self.mft_plot = FigureCanvas(panel, -1, self.figure1)
self.SpinCtrl_Y = wx.SpinCtrl(panel, value="0", size=(60,30), max = 10000) # Y
self.SpinCtrl_times = wx.SpinCtrl(panel, value="0",size=(100,30),min=-200, max=500) # time
btn5 = wx.Button(panel, label = 'Create Vol. Image', pos = ((650), 10),
size = (150, 25))
btn5.Bind(wx.EVT_BUTTON, self.OnPlotCreation)
def OnPlotCreation(self, e):
print 'Waiting for time point..'
t_enter = self.SpinCtrl_times.GetValue()
# Transform time sample point to dimensional time point ..
self.t_in_ms0 = t_enter * 1e3
print 'Seleted time point is: %.2f ms' %self.t_in_ms0
# Check for a threshold..
threshold = self.mftthreshold.GetValue()
self.figure1.clear()
print 'Plot.'
plotting.plot_stat_map( index_img( self.img, float(t_enter) ), figure = self.figure1, threshold= threshold, cut_coords=(self.SpinCtrl_Y.GetValue()),
annotate=True, title='t=%.2f ms' %self.t_in_ms0 )
For an simple example i posted you this, a lil bit long, code sample. The goal I want to achieve is the function automatically runs again after
self.mftthreshold
or
self.SpinCtrl_times
or self.SpinCtrl_Y
was changed.
I hope anyone can give me a hind on how to make this possible.
Thankful Greetings, Daniel