From 0b6069f8c5840665bb1f7440db2304760987f065 Mon Sep 17 00:00:00 2001 From: jens Date: Sat, 12 Dec 2020 19:27:20 +0100 Subject: [PATCH] commit --- JFSphoto.py | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/JFSphoto.py b/JFSphoto.py index 1cb9f36..aabd1b1 100644 --- a/JFSphoto.py +++ b/JFSphoto.py @@ -219,19 +219,22 @@ class Jfsphoto (object): except IOError: messagebox.showerror("By the great otter!","There's a problem saving the file.") - def save_kinetics(self,name): + def save_kinetics(self): + filename = filedialog.asksaveasfilename(defaultextension=".csv", title="Save file as") try: - self.df.to_csv(name) + self.df.to_csv(filename) except IOError: messagebox.showerror("By the great otter!","There's a problem saving the file.") - def load_kinetics(self,name): + def load_kinetics(self): + filename = filedialog.askopenfilename(defaultextension=".csv", title="Open file ") try: - #self.df.drop(self.df.index, inplace=True) - self.df = pd.read_csv(name,index_col=0) - #print(self.df.head()) + self.listbox.delete(0,tk.END) + self.df = pd.read_csv(filename,index_col=0) + self.calculate() + self.show_first_look() except IOError: - messagebox.showerror("By the great otter!","There's a problem saving the file.") + messagebox.showerror("By the great otter!","There's a problem loding the file.") def load_pandas(self): filename = filedialog.askopenfilename(defaultextension=".csv", title="Open file ") @@ -316,36 +319,32 @@ class Jfsphoto (object): self.ctr_right = tk.Frame(self.center, width=200, height=300, padx=3, pady=3) self.ctr_mid.grid(row=0, column=0, sticky="nsew") self.ctr_right.grid(row=0, column=1, sticky="ns") - self.fig = plt.Figure(figsize=(8,4),dpi=120) plt.rc('legend',fontsize=8) self.ax1 = self.fig.add_subplot(111) - - - - self.canvas = FigureCanvasTkAgg(self.fig, master = self.ctr_mid) self.canvas._tkcanvas.pack(side = tk.TOP, fill = tk.BOTH, expand = 1) self.toolbarFrame = tk.Frame(master=self.center,padx=5,pady=5) self.toolbarFrame.grid(row=1,columnspan=2, sticky="w") self.toolbar1 = NavigationToolbar2Tk(self.canvas, self.toolbarFrame) - + #### Buttons n = 0 for txt,val in stati: tk.Radiobutton(master=self.ctr_right,text=txt,variable=self.ok,command=self.look,value=val,padx=5,pady=5).grid(row=n,column=0,sticky="w") n=n+1 - - self.kbtn = tk.Button(master=self.ctr_right,text="Load Kini",command=self.kini) - self.kbtn.grid(row=7,column=0,sticky="w") - self.listbox = tk.Listbox(master=self.ctr_right,selectmode = "multiple") - self.listbox.grid(row=8,column=0,sticky='w') - self.scrollbar = tk.Scrollbar(master=self.ctr_right) - self.listbox.config(yscrollcommand =self.scrollbar.set) - self.scrollbar.config(command = self.listbox.yview) - self.kbtn1 = tk.Button(master=self.ctr_right,text="show",command=self.show_selected) + self.listbox.grid(row=7,column=0,sticky='w') + self.kbtn1 = tk.Button(master=self.ctr_right,text="show selected",command=self.show_selected,width=15) self.kbtn1.grid(row=14,column=0,sticky="w") - + self.kbtn = tk.Button(master=self.ctr_right,text="Load Kinetic / Data",command=self.load_kinetics,width=15) + self.kbtn.grid(row=15,column=0,sticky="w") + self.kbtn = tk.Button(master=self.ctr_right,text="Save Kinetic / Data",command=self.save_kinetics,width=15) + self.kbtn.grid(row=16,column=0,sticky="w") + + #self.scrollbar = tk.Scrollbar(master=self.ctr_right) + #self.listbox.config(yscrollcommand =self.scrollbar.set) + #self.scrollbar.config(command = self.listbox.yview) + if self.calculate() : self.show_first_look()