i have an onclick function that takes self and event (event is of type instance ) so can i save this event in xml or .txt file so i can open it back again by browse button as an event instance and give it back to this add_point function
def add_point(self, event):
if self.radioButton.isChecked() == True:
if ((event.xdata)**2 + (event.ydata)**2)**0.5 < 1 and event.ydata >0 :
print(type(event))
print (event)
z = event.xdata + event.ydata * 1j
self.xy.append([event.xdata, event.ydata])
self.xy.append([event.xdata, -event.ydata])
self.zero.append(z)
print (self.zero)
self.update()
def browse(self):
filepath = QtGui.QFileDialog.getOpenFileName(self, 'Single File', "C:\Users\Hanna Nabil\Documents",'*.txt')
f= str(filepath)
file =open(filepath ,'r')
connect = self.fig.canvas.mpl_connect
connect('button_press_event', self.on_click)
self.draw_cid = connect('draw_event', self.grab_background)
with file:
text= file.read()
#self.add_point(c)
print(text)