math bug changed

This commit is contained in:
jens 2020-12-05 18:34:49 +01:00
parent 9305e14806
commit c2e407cd41
3 changed files with 105 additions and 19 deletions

View File

@ -39,6 +39,7 @@ import CCDfiles
#jfs
from JFSphoto import *
class buildpanel(tk.Frame):
def __init__(self, master, CCDplot, SerQueue,JFSphoto):
#geometry-rows for packing the grid
@ -75,6 +76,7 @@ class buildpanel(tk.Frame):
self.updateplotfields(update_row, CCDplot)
#
self.jf = JFSphoto
self.jfsAddOns(CCDplot)
@ -274,6 +276,7 @@ class buildpanel(tk.Frame):
kin_repeats.set(kin_repeats.get()-1)
self.after(kin_delta.get()*1000,messure)
self.jfstitel = tk.Label(self, text=' Photometer ',fg="#6A9662")
#self.jfstitel.config(font=("Courier",0))

49
JFSmath.py Normal file
View File

@ -0,0 +1,49 @@
import tkinter as tk
import matplotlib.pyplot as plt
#matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from numpy import arange, sin, pi
from JFSphoto import *
class JfsMath(object):
def __init__(self,master,JFSphoto):
self.master = master
master.title("Mathoptions")
self.ok = tk.IntVar()
self.center = tk.Frame(self.master, bg='gray2', width=50, height=40, padx=3, pady=3)
self.master.grid_rowconfigure(1, weight=1)
self.master.grid_columnconfigure(0, weight=1)
self.center.grid_rowconfigure(0, weight=1)
self.center.grid_columnconfigure(1, weight=1)
self.center.grid(row=1, sticky="nsew")
self.ctr_mid = tk.Frame(self.center, bg='yellow', width=250, height=190, padx=3, pady=3)
self.ctr_right = tk.Frame(self.center, bg='green', width=100, height=190, 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=100)
self.ax1 = self.fig.add_subplot(111)
t = arange(0.0, 3.0, 0.01)
s = sin(2*pi*t)
self.ax1.plot(t, s, linewidth=0.6)
self.canvas = FigureCanvasTkAgg(self.fig, master = self.ctr_mid)
self.canvas._tkcanvas.pack(side = tk.TOP, fill = tk.BOTH, expand = 1)
self.chb = tk.Checkbutton(master=self.ctr_right,text='Hi there',variable=self.ok,command=self.look)
self.chb.grid(row=0,column=0)
def look(self):
print(self.ok.get())
#jfsmath()
root = tk.Tk()
jfs = Jfsphoto()
jfs.conf_read()
my = JfsMath(root,jfs)
root.mainloop()

View File

@ -13,6 +13,7 @@ import matplotlib.pyplot as plt
#matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
from numpy import arange, sin, pi
####################################### object
class Jfsphoto (object):
@ -48,6 +49,9 @@ class Jfsphoto (object):
########## dataframe to load and save photometer data
self.pandas_count = 0
self.df = pd.DataFrame()
######### jfs math
self.ok = tk.IntVar()
self.ok.set(0)
def do_calibrate(self):
win = tk.Toplevel()
@ -270,25 +274,55 @@ class Jfsphoto (object):
except IOError:
print("By the great otter!","No config.ini file")
def do_math(self):
root = tk.Tk()
#def do_math(self):
# root = tk.Tk()
center = tk.Frame(root, bg='gray2', width=50, height=40, padx=3, pady=3)
root.grid_rowconfigure(1, weight=1)
root.grid_columnconfigure(0, weight=1)
center.grid(row=1, sticky="nsew")
center.grid_rowconfigure(0, weight=1)
center.grid_columnconfigure(1, weight=1)
ctr_mid = tk.Frame(center, bg='yellow', width=250, height=190, padx=3, pady=3)
ctr_right = tk.Frame(center, bg='green', width=100, height=190, padx=3, pady=3)
ctr_mid.grid(row=0, column=0, sticky="nsew")
ctr_right.grid(row=0, column=1, sticky="ns")
# center = tk.Frame(root, bg='gray2', width=50, height=40, padx=3, pady=3)
# root.grid_rowconfigure(1, weight=1)
# root.grid_columnconfigure(0, weight=1)
# center.grid(row=1, sticky="nsew")
# center.grid_rowconfigure(0, weight=1)
# center.grid_columnconfigure(1, weight=1)
# ctr_mid = tk.Frame(center, bg='yellow', width=250, height=190, padx=3, pady=3)
# ctr_right = tk.Frame(center, bg='green', width=100, height=190, padx=3, pady=3)
# ctr_mid.grid(row=0, column=0, sticky="nsew")
# ctr_right.grid(row=0, column=1, sticky="ns")
root.title("Mathoptions")
fig = plt.Figure(figsize=(8,4),dpi=100)
ax1 = fig.add_subplot(111)
self.df.plot(x = 'nmscale',y = 'p1', color='red',linewidth=0.6,ax=ax1)
canvas = FigureCanvasTkAgg(fig, master = ctr_mid)
canvas._tkcanvas.pack(side = tk.TOP, fill = tk.BOTH, expand = 1)
# root.title("Mathoptions")
# fig = plt.Figure(figsize=(8,4),dpi=100)
# ax1 = fig.add_subplot(111)
# self.df.plot(x = 'nmscale',y = 'p1', color='red',linewidth=0.6,ax=ax1)
# canvas = FigureCanvasTkAgg(fig, master = ctr_mid)
# canvas._tkcanvas.pack(side = tk.TOP, fill = tk.BOTH, expand = 1)
root.mainloop()
# root.mainloop()
def do_math(self):
win = tk.Toplevel()
#win.geometry("450x200+100+100")
self.center = tk.Frame(win, bg='gray2', width=50, height=40, padx=3, pady=3)
# self.master.grid_rowconfigure(1, weight=1)
# self.master.grid_columnconfigure(0, weight=1)
self.center.grid_rowconfigure(0, weight=1)
self.center.grid_columnconfigure(1, weight=1)
self.center.grid(row=1, sticky="nsew")
self.ctr_mid = tk.Frame(self.center, bg='yellow', width=250, height=190, padx=3, pady=3)
self.ctr_right = tk.Frame(self.center, bg='green', width=100, height=190, 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=100)
self.ax1 = self.fig.add_subplot(111)
t = arange(0.0, 3.0, 0.01)
s = sin(2*pi*t)
self.ax1.plot(t, s, linewidth=0.6)
self.canvas = FigureCanvasTkAgg(self.fig, master = self.ctr_mid)
self.canvas._tkcanvas.pack(side = tk.TOP, fill = tk.BOTH, expand = 1)
self.chb = tk.Checkbutton(master=self.ctr_right,text='Hi there',variable=self.ok,command=self.look)
self.chb.grid(row=0,column=0)
win.focus_set()
win.grab_set()
win.wait_window()
def look(self):
print(self.ok.get())