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 #jfs
from JFSphoto import * from JFSphoto import *
class buildpanel(tk.Frame): class buildpanel(tk.Frame):
def __init__(self, master, CCDplot, SerQueue,JFSphoto): def __init__(self, master, CCDplot, SerQueue,JFSphoto):
#geometry-rows for packing the grid #geometry-rows for packing the grid
@ -77,6 +78,7 @@ class buildpanel(tk.Frame):
self.jf = JFSphoto self.jf = JFSphoto
self.jfsAddOns(CCDplot) self.jfsAddOns(CCDplot)
@ -275,6 +277,7 @@ class buildpanel(tk.Frame):
self.after(kin_delta.get()*1000,messure) self.after(kin_delta.get()*1000,messure)
self.jfstitel = tk.Label(self, text=' Photometer ',fg="#6A9662") self.jfstitel = tk.Label(self, text=' Photometer ',fg="#6A9662")
#self.jfstitel.config(font=("Courier",0)) #self.jfstitel.config(font=("Courier",0))
self.jfstitel.grid(row=device_row,column=4,columnspan=2,sticky='w') self.jfstitel.grid(row=device_row,column=4,columnspan=2,sticky='w')

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") #matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure from matplotlib.figure import Figure
from numpy import arange, sin, pi
####################################### object ####################################### object
class Jfsphoto (object): class Jfsphoto (object):
@ -48,6 +49,9 @@ class Jfsphoto (object):
########## dataframe to load and save photometer data ########## dataframe to load and save photometer data
self.pandas_count = 0 self.pandas_count = 0
self.df = pd.DataFrame() self.df = pd.DataFrame()
######### jfs math
self.ok = tk.IntVar()
self.ok.set(0)
def do_calibrate(self): def do_calibrate(self):
win = tk.Toplevel() win = tk.Toplevel()
@ -270,25 +274,55 @@ class Jfsphoto (object):
except IOError: except IOError:
print("By the great otter!","No config.ini file") print("By the great otter!","No config.ini file")
#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")
# 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()
def do_math(self): def do_math(self):
root = tk.Tk()
center = tk.Frame(root, bg='gray2', width=50, height=40, padx=3, pady=3) win = tk.Toplevel()
root.grid_rowconfigure(1, weight=1) #win.geometry("450x200+100+100")
root.grid_columnconfigure(0, weight=1) self.center = tk.Frame(win, bg='gray2', width=50, height=40, padx=3, pady=3)
center.grid(row=1, sticky="nsew") # self.master.grid_rowconfigure(1, weight=1)
center.grid_rowconfigure(0, weight=1) # self.master.grid_columnconfigure(0, weight=1)
center.grid_columnconfigure(1, weight=1) self.center.grid_rowconfigure(0, weight=1)
ctr_mid = tk.Frame(center, bg='yellow', width=250, height=190, padx=3, pady=3) self.center.grid_columnconfigure(1, weight=1)
ctr_right = tk.Frame(center, bg='green', width=100, height=190, padx=3, pady=3) self.center.grid(row=1, sticky="nsew")
ctr_mid.grid(row=0, column=0, sticky="nsew") self.ctr_mid = tk.Frame(self.center, bg='yellow', width=250, height=190, padx=3, pady=3)
ctr_right.grid(row=0, column=1, sticky="ns") 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)
root.title("Mathoptions") win.focus_set()
fig = plt.Figure(figsize=(8,4),dpi=100) win.grab_set()
ax1 = fig.add_subplot(111) win.wait_window()
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() def look(self):
print(self.ok.get())