starting with help
This commit is contained in:
parent
cad44b8f3c
commit
4820b0a19a
96
JFShelp.py
Normal file
96
JFShelp.py
Normal file
@ -0,0 +1,96 @@
|
||||
# Copyright (c) 2019 Esben Rossel
|
||||
# All rights reserved.
|
||||
#
|
||||
# Author: Esben Rossel <esbenrossel@gmail.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
import os
|
||||
import tkinter as tk
|
||||
from PIL import Image,ImageTk
|
||||
|
||||
def center_window(size, window) :
|
||||
window_width = size[0] #Fetches the width you gave as arg. Alternatively window.winfo_width can be used if width is not to be fixed by you.
|
||||
window_height = size[1] #Fetches the height you gave as arg. Alternatively window.winfo_height can be used if height is not to be fixed by you.
|
||||
if window==None:
|
||||
window_x = 200
|
||||
window_y = 200
|
||||
else:
|
||||
window_x = int((window.winfo_screenwidth() / 2) - (window_width / 2)) #Calculates the x for the window to be in the centre
|
||||
window_y = int((window.winfo_screenheight() / 2) - (window_height / 2)) #Calculates the y for the window to be in the centre
|
||||
|
||||
window_geometry = str(window_width) + 'x' + str(window_height) + '+' + str(window_x) + '+' + str(window_y) #Creates a geometric string argument
|
||||
window.geometry(window_geometry) #Sets the geometry accordingly.
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def jfshelpme(win,helpfor):
|
||||
#### this is where we store the pictures etc
|
||||
directory_path = os.path.dirname(__file__)
|
||||
file_path = os.path.join(directory_path, 'images\\')
|
||||
|
||||
top = tk.Toplevel(win)
|
||||
scrolling = tk.Scrollbar(top)
|
||||
scrolling.pack(side=tk.RIGHT, fill=tk.Y)
|
||||
|
||||
frame = tk.Frame(top)
|
||||
frame.pack()
|
||||
text = tk.Text(frame, height=30, width=100, wrap=tk.WORD)
|
||||
text.pack(side=tk.LEFT, fill=tk.Y)
|
||||
scrolling.config(command=text.yview)
|
||||
text.config(yscrollcommand=scrolling.set)
|
||||
|
||||
image1 = Image.open(file_path+'nm405.gif')
|
||||
photoImg = ImageTk.PhotoImage(image1)
|
||||
image2 = Image.open(file_path+'methods.gif')
|
||||
photoImg2= ImageTk.PhotoImage(image2)
|
||||
image3 = Image.open(file_path+'kinetics.gif')
|
||||
photoImg3= ImageTk.PhotoImage(image3)
|
||||
|
||||
text.tag_configure('it', font=('Arial', 10, 'italic'))
|
||||
text.tag_configure('h1', font=('Verdana', 16, 'bold'))
|
||||
text.tag_configure('h2', font=('Verdana', 12, 'bold'))
|
||||
text.tag_configure('h3', font=('Verdana', 10, 'bold'))
|
||||
|
||||
if (helpfor == 0): #do you need help with the device?
|
||||
text.image_create(tk.END,image=photoImg)
|
||||
text.insert(tk.END, " Calibration\n", 'h1')
|
||||
text.insert(tk.END, "\nTo calibrate the Instrument we need two laserpointer of different colors und known wavelength.\nFor example a blue [405nm] and red [650nm] one.\n")
|
||||
text.insert(tk.END, "1) First take two messurements with your device und save the files with the [Save] button under a comprehensible name (e.g. 405nm.data) \n")
|
||||
text.insert(tk.END, "2) Open the calibration dialog and insert the wavelength in [nm] and afterwards select the respective file. <first peak> stands for the lower and <second peak> for the higher wavelength.\n")
|
||||
text.insert(tk.END, "3) Now you can use the [Calibrate] button to calibrate the instrument and [Save Config] will the store the configuration.\n")
|
||||
text.insert(tk.END,"\nAfter this procedure you can switch the [nm] scale on and use other option:\n")
|
||||
text.insert(tk.END,'\nMethods\n','h2')
|
||||
text.insert(tk.END,"\nAs a Photometer to messure the transmittance or absorbance depending on the concentration of colored compounds.\n\n")
|
||||
text.image_create(tk.END,image=photoImg2)
|
||||
text.insert(tk.END,"\n\nKinetic\n",'h2')
|
||||
text.insert(tk.END,"\nThe instrument can messure in specific intervalls over time the change in absorbance. From this data it is possible to determine the rate of the reaction.\n")
|
||||
text.image_create(tk.END,image=photoImg3)
|
||||
### at the end
|
||||
text.config(state=tk.DISABLED)
|
||||
top.focus_set()
|
||||
top.grab_set()
|
||||
top.wait_window()
|
||||
20
JFSphoto.py
20
JFSphoto.py
@ -23,6 +23,7 @@ from matplotlib.backend_bases import key_press_handler
|
||||
from tkinter import ttk
|
||||
import CCDpanelsetup as panel
|
||||
from sklearn.metrics import r2_score
|
||||
from JFShelp import *
|
||||
####################################### object
|
||||
class Messurement(object):
|
||||
### nr -> na
|
||||
@ -133,14 +134,15 @@ class Jfsphoto (object):
|
||||
|
||||
def do_calibrate(self):
|
||||
win = tk.Toplevel()
|
||||
win.geometry("450x200+100+100")
|
||||
win.geometry("450x200+200+200")
|
||||
#center_window([500,300],None)
|
||||
self.lab1 = tk.Label(win, text='Please enter filenames and nm of the peaks').grid(row=0,column=0,columnspan=6)
|
||||
########## first peak
|
||||
self.tnm = tk.StringVar()
|
||||
self.tnm.set(str(self.nm))
|
||||
self.tnmi = tk.StringVar()
|
||||
self.tnmi.set(str(self.nmi))
|
||||
self.lab2 = tk.Label(win,text='first Peak nm').grid(row=1,column=0)
|
||||
self.lab2 = tk.Label(win,text='first Peak nm').grid(row=1,column=0,sticky='w')
|
||||
self.en1 = tk.Entry(win,textvariable=self.tnm, width= 10).grid(row=1,column=1)
|
||||
self.bt1 = tk.Button(win,text="select File",command=lambda: self.openfile(1)).grid(row=1,column=2)
|
||||
self.lnm = tk.Label(win,textvariable =self.tnm).grid(row=1,column=3)
|
||||
@ -151,7 +153,7 @@ class Jfsphoto (object):
|
||||
self.tnm2.set(str(self.nm2))
|
||||
self.tnm2i = tk.StringVar()
|
||||
self.tnm2i.set(str(self.nm2i))
|
||||
self.lab3 = tk.Label(win,text='second Peak nm').grid(row=2,column=0)
|
||||
self.lab3 = tk.Label(win,text='second Peak nm').grid(row=2,column=0,sticky='w')
|
||||
self.en2 = tk.Entry(win,textvariable=self.tnm2, width= 10).grid(row=2,column=1)
|
||||
self.bt2 = tk.Button(win,text="select File",command=lambda: self.openfile(2)).grid(row=2,column=2)
|
||||
self.lnm2 = tk.Label(win,textvariable =self.tnm2).grid(row=2,column=3)
|
||||
@ -161,21 +163,23 @@ class Jfsphoto (object):
|
||||
self.tnm_left.set(str(self.nm_left))
|
||||
self.tnm_right.set(str(self.nm_right))
|
||||
self.tnm_step.set(str(self.nm_step))
|
||||
self.lab4 = tk.Label(win,text="left border [nm]").grid(row=3,column=0)
|
||||
self.lab4 = tk.Label(win,text="left border [nm]").grid(row=3,column=0,sticky='w')
|
||||
self.lab5 = tk.Label(win,textvariable=self.tnm_left).grid(row=3,column=1)
|
||||
self.lab6 = tk.Label(win,text="right border [nm]").grid(row=3,column=2)
|
||||
self.lab7 = tk.Label(win,textvariable=self.tnm_right).grid(row=3,column=3)
|
||||
self.lab8 = tk.Label(win,text="[nm]/point").grid(row=3,column=4)
|
||||
self.lab9 = tk.Label(win,textvariable=self.tnm_step).grid(row=3,column=5)
|
||||
self.bt3 = tk.Button(win,text="Calibrieren",command=self.calibrate,state=tk.DISABLED)
|
||||
self.bt3.grid(row=4,column=0)
|
||||
self.bt3 = tk.Button(win,text="Calibrate",command=self.calibrate,state=tk.DISABLED,padx=10)
|
||||
self.bt3.grid(row=4,column=0,sticky='w')
|
||||
############ limit for the baseline the baseline starts and ends at a higher intensisity depending on
|
||||
# the spectrum of the light source
|
||||
self.lab10 = tk.Label(win,text="threshold for the baseline").grid(row=5,column=0,columnspan=2, sticky="w")
|
||||
self.en3 = tk.Entry(win,textvariable=self.baseline_limit, width= 10).grid(row=5,column=2)
|
||||
############ Save Load config
|
||||
self.bt4 = tk.Button(win,text="Load Config",command=self.conf_read).grid(row=6,column=0)
|
||||
self.bt5 = tk.Button(win,text="Save Config",command=self.conf_write).grid(row=6,column=1)
|
||||
self.bt4 = tk.Button(win,text="Load Config",command=self.conf_read,padx=10).grid(row=6,column=0,sticky='w')
|
||||
self.bt5 = tk.Button(win,text="Save Config",command=self.conf_write,padx=10).grid(row=6,column=1,sticky='w')
|
||||
############ Help
|
||||
self.bt5 = tk.Button(win,text="Help me",command=lambda roots = win ,helpfor=0: jfshelpme(roots,helpfor),padx=10).grid(row=7,column=0,sticky='w')
|
||||
|
||||
########### dialog modal
|
||||
win.focus_set()
|
||||
|
||||
BIN
images/kinetics.gif
Normal file
BIN
images/kinetics.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
BIN
images/methods.gif
Normal file
BIN
images/methods.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
BIN
images/nm405.gif
Normal file
BIN
images/nm405.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
BIN
images/nm405.jpg
Normal file
BIN
images/nm405.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
Loading…
Reference in New Issue
Block a user