i am making an GUI for plotting graph and embedding software . But i cannot link a browse button with that run button function. i am writing the whole path at the backend of the run button while i am also read the file path at the browse button too .
forexample
def OnButtonBrowse(self, event):
self.dirname = ‘/home’
dlg = wx.FileDialog(self, “Choose a file”, self.dirname, “”,“CSV files (.csv)|.csv”, wx.FD_OPEN)
if dlg.ShowModal() == wx.ID_OK:
self.filename = dlg.GetFilename()
print self.filename
self.dirname=dlg.GetDirectory()
# if self.filename[-3:]=='csv':
f = open(os.path.join(self.dirname, self.filename), 'r')
self.csvText.SetValue('u'+self.dirname+self.filename)
x=wx.BusyInfo(" Please wait,Loading File.\n\n 'Adopt the Pace of Nature, Her Secret is Patience...'")
wx.Yield()
self.csv_data=f.read()
f.close()
def OnGraphitButton(self, event):
global p
global Line
global Data
p = GracePlot() # A grace session opens
l1=Line(type="2")
x1=[]
y1=[]
fr=open("/home/ayesha/Documents/Source_code/b.csv","r").readlines()
parts = fr[-1].split(",")[0]
print(parts)
for line in fr:
if not line.startswith('DEL') and not line.startswith('Fr'):
ab=line.replace('\n', '').split(',')
x1.append(float(ab[0]))
y1.append(float(ab[1]))
d2=Data(x=x1,y=y1,line=l1)
g=p[0]
g.plot([d2])
g.xaxis(label=Label('X axis',font=5,charsize=1.5),
tick=Tick(majorgrid=True,majorlinestyle=lines.none,majorcolor=colors.blue,
minorgrid=True,minorlinestyle=lines.none,minorcolor=colors.blue))
g.yaxis(tick=Tick(majorgrid=True,majorlinestyle=lines.none,majorcolor=colors.blue,
minorgrid=True,minorlinestyle=lines.none,minorcolor=colors.blue))
how can i join first button function under second button so that the uploaded file can read and all the work done at the ther button