I have a very simple GUI that accepts two parameters and then calls three other classes whose names are DigitalFilter(), BeatByBeatVariables(), and GetSummaryOfWholeTest(). This is my first time writing up classes, and I need help with the syntax.
Specifically, can you help me with inheritance? I want the GUI's class MainWindow(wx.Frame) to be called when the application launches. Then, when the user clicks on self.button in the GUI, I want the application to first run myFilter=DigitalFilter(TestID,FilterTimePeriod), then second run myBeatByBeat = BeatByBeatVariables(arg1,arg2), and finally third run myTestSummary = GetSummaryOfWholeTest(argA,argB)
Note that myBeatByBeat cannot begin to run until myFilter has finished being created, because instantiation of myFilter creates csv files that are required as inputs to myBeatByBeat. Similarly, myTest Summary cannot begin to run until myBeatByBeat has finished being created because instantiation of myBeatByBeat creates csv files which are required as input to myTestSummary.
Can anyone show me the proper syntax for writing/instantiating these classes with the appropriate inheritance so that the work of each class will be done in a sequence that respects their input/output relationships?
I am assuming that inheritance should be employed here, but I do not know what should inherit from what. I also do not know if I am failing to see other concepts that are necessary to give the code the necessary inter-relationships.
Here is a synopsis of the relevant code:
class DigitalFilter():
def __init__(self,TestID,FilterTimePeriod):
# All the code for the digital filter goes here.
# I am omitting this class' code for simplicity.
class BeatByBeatVariables():
def __init__(self,arg1,arg2):
# I am omitting this class' code for simplicity
class GetSummaryOfWholeTest():
def __init__(self,argA,ArgB):
# This class' code is omitted for simplicity
class MainWindow(wx.Frame):
def __init__(self, parent,id,title):
wx.Frame.__init__(self,parent,wx.ID_ANY,title, size = (500,500), style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
# Create self.editname and self.edithear in code that I am omitting for simplicity
self.button =wx.Button(self, label="Click here to filter the data", pos=(200, 125))
self.Bind(wx.EVT_BUTTON, self.OnClick,self.button)
def OnClick(self,event):
FilterTimePeriod = self.editname.GetValue()
TestID = self.edithear.GetValue()
myFilter=DigitalFilter(TestID,FilterTimePeriod)
myBeatByBeat = BeatByBeatVariables(arg1,arg2)
myTestSummary = GetSummaryOfWholeTest(argA,argB)
app = wx.PySimpleApp()
frame = MainWindow(None,-1,"Filtering Software. Version 1.0")
app.MainLoop()
Note: I am using Python 2.6 because I am also using numpy and sciepy