Trying to create a tkinter based window that allows user to create a chart on button click, refreshing the chart -- not adding another, each time. All without creating a new
For your current setup, just add a try clause at the start of your plot
function.
def plot(self):
try:
self.wierdobject.get_tk_widget().pack_forget()
except AttributeError:
pass
f=Figure(figsize=(5,1))
aplt=f.add_subplot(111)
aplt.plot([1,2,3,4])
self.wierdobject = FigureCanvasTkAgg(f, master=self.frame1)
self.wierdobject.get_tk_widget().pack()
self.wierdobject.draw()