jfs start
This commit is contained in:
parent
30659423f4
commit
5870ee5443
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -1,3 +1,2 @@
|
|||||||
{
|
{
|
||||||
"python.pythonPath": "C:\\Users\\server2\\Anaconda3\\python.exe"
|
|
||||||
}
|
}
|
||||||
@ -36,6 +36,9 @@ from CCDhelp import *
|
|||||||
import CCDserial
|
import CCDserial
|
||||||
import CCDfiles
|
import CCDfiles
|
||||||
|
|
||||||
|
#jfs
|
||||||
|
from JFSphoto import *
|
||||||
|
|
||||||
class buildpanel(tk.Frame):
|
class buildpanel(tk.Frame):
|
||||||
def __init__(self, master, CCDplot, SerQueue):
|
def __init__(self, master, CCDplot, SerQueue):
|
||||||
#geometry-rows for packing the grid
|
#geometry-rows for packing the grid
|
||||||
@ -69,6 +72,8 @@ class buildpanel(tk.Frame):
|
|||||||
self.plotmodefields(plotmode_row, CCDplot)
|
self.plotmodefields(plotmode_row, CCDplot)
|
||||||
self.saveopenfields(save_row, CCDplot)
|
self.saveopenfields(save_row, CCDplot)
|
||||||
self.updateplotfields(update_row, CCDplot)
|
self.updateplotfields(update_row, CCDplot)
|
||||||
|
#
|
||||||
|
self.jfsAddOns(CCDplot)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -216,6 +221,18 @@ class buildpanel(tk.Frame):
|
|||||||
#self.bupdate.grid(row=update_row, columnspan=3, sticky="EW", padx=5)
|
#self.bupdate.grid(row=update_row, columnspan=3, sticky="EW", padx=5)
|
||||||
|
|
||||||
|
|
||||||
|
def jfsAddOns(self,CCDplot):
|
||||||
|
self.jfstitel = tk.Label(self, text=' Photometer ',width=20)
|
||||||
|
self.jfstitel.config(font=("Courier",0))
|
||||||
|
self.jfstitel.grid(row=10,column=4)
|
||||||
|
self.jfs4nm = tk.Button(self,text='Choose Color',fg="darkgreen", command=jfs_test1)
|
||||||
|
self.jfs4nm.grid(row=20,column=4)
|
||||||
|
|
||||||
|
### JfsCallbacks
|
||||||
|
def jfs4nmcallback(self):
|
||||||
|
print('Hi there')
|
||||||
|
#self.result = askcolor(color="#6A9662", title = "Bernd's Colour Chooser")
|
||||||
|
|
||||||
|
|
||||||
### Callbacks for traces, buttons, etc ###
|
### Callbacks for traces, buttons, etc ###
|
||||||
def callback(self):
|
def callback(self):
|
||||||
|
|||||||
54
JFSphoto.py
Normal file
54
JFSphoto.py
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
from tkinter.colorchooser import askcolor
|
||||||
|
from tkinter import filedialog
|
||||||
|
from tkinter import messagebox
|
||||||
|
import tkinter as tk
|
||||||
|
import csv
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
def jfs_test():
|
||||||
|
result = askcolor(color="#6A9662", title = "Bernd's Colour Chooser")
|
||||||
|
print (result)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def jfs_test1():
|
||||||
|
win = tk.Toplevel()
|
||||||
|
win.geometry("400x200+30+30")
|
||||||
|
lab1 = tk.Label(win, text='please enter filenames and nm of the peaks').grid(row=0,column=0,columnspan=2)
|
||||||
|
lab2 = tk.Label(win,text='Peak nm').grid(row=1,column=0)
|
||||||
|
en1 = tk.Entry(win).grid(row=1,column=1)
|
||||||
|
bt1 = tk.Button(win,text="select File",command=openfile).grid(row=1,column=2)
|
||||||
|
#a=tk.Label(win,text='Hi there')
|
||||||
|
#a.place(x=10,y=10,width=40,height=25)
|
||||||
|
#b=tk.Button(win,text='Ok then',command=win.destroy)
|
||||||
|
#b.place(x=60,y=10,width=60,height=25)
|
||||||
|
## modal
|
||||||
|
win.focus_set()
|
||||||
|
win.grab_set()
|
||||||
|
win.wait_window()
|
||||||
|
|
||||||
|
|
||||||
|
def openfile():
|
||||||
|
rxData16 = np.zeros(3694, np.uint16)
|
||||||
|
filename = filedialog.askopenfilename(defaultextension=".dat", title="Open file")
|
||||||
|
line_count = 0
|
||||||
|
try:
|
||||||
|
with open(filename) as csvfile:
|
||||||
|
readCSV = csv.reader(csvfile, delimiter=' ')
|
||||||
|
|
||||||
|
for row in readCSV:
|
||||||
|
if (line_count == 3):
|
||||||
|
SHsent = int(row[1])
|
||||||
|
ICGsent = int(row[6])
|
||||||
|
if (line_count > 3):
|
||||||
|
rxData16[line_count-4] = int(row[1])
|
||||||
|
line_count += 1
|
||||||
|
|
||||||
|
except IOError:
|
||||||
|
messagebox.showerror("By the great otter!","There's a problem opening the file.")
|
||||||
|
|
||||||
|
print(rxData16[12])
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
__pycache__/JFSphoto.cpython-37.pyc
Normal file
BIN
__pycache__/JFSphoto.cpython-37.pyc
Normal file
Binary file not shown.
Binary file not shown.
21
test_button.py
Normal file
21
test_button.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import tkinter as tk
|
||||||
|
|
||||||
|
counter = 0
|
||||||
|
def counter_label(label):
|
||||||
|
counter = 0
|
||||||
|
def count():
|
||||||
|
global counter
|
||||||
|
counter += 1
|
||||||
|
label.config(text=str(counter))
|
||||||
|
label.after(1000, count)
|
||||||
|
count()
|
||||||
|
|
||||||
|
|
||||||
|
root = tk.Tk()
|
||||||
|
root.title("Counting Seconds")
|
||||||
|
label = tk.Label(root, fg="dark green")
|
||||||
|
label.pack()
|
||||||
|
counter_label(label)
|
||||||
|
button = tk.Button(root, text='Stop', width=25, command=root.destroy)
|
||||||
|
button.pack()
|
||||||
|
root.mainloop()
|
||||||
18
test_choosecolor.py
Normal file
18
test_choosecolor.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from tkinter import *
|
||||||
|
from tkinter.colorchooser import askcolor
|
||||||
|
|
||||||
|
def callback():
|
||||||
|
result = askcolor(color="#6A9662",
|
||||||
|
title = "Bernd's Colour Chooser")
|
||||||
|
print (result)
|
||||||
|
|
||||||
|
|
||||||
|
root = Tk()
|
||||||
|
Button(root,
|
||||||
|
text='Choose Color',
|
||||||
|
fg="darkgreen",
|
||||||
|
command=callback).pack(side=LEFT, padx=10)
|
||||||
|
Button(text='Quit',
|
||||||
|
command=root.quit,
|
||||||
|
fg="red").pack(side=LEFT, padx=10)
|
||||||
|
mainloop()
|
||||||
31
test_dialog.py
Normal file
31
test_dialog.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
from tkinter import *
|
||||||
|
fields = 'Last Name', 'First Name', 'Job', 'Country'
|
||||||
|
|
||||||
|
def fetch(entries):
|
||||||
|
for entry in entries:
|
||||||
|
field = entry[0]
|
||||||
|
text = entry[1].get()
|
||||||
|
print('%s: "%s"' % (field, text))
|
||||||
|
|
||||||
|
def makeform(root, fields):
|
||||||
|
entries = []
|
||||||
|
for field in fields:
|
||||||
|
row = Frame(root)
|
||||||
|
lab = Label(row, width=15, text=field, anchor='w')
|
||||||
|
ent = Entry(row)
|
||||||
|
row.pack(side=TOP, fill=X, padx=5, pady=5)
|
||||||
|
lab.pack(side=LEFT)
|
||||||
|
ent.pack(side=RIGHT, expand=YES, fill=X)
|
||||||
|
entries.append((field, ent))
|
||||||
|
return entries
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
root = Tk()
|
||||||
|
ents = makeform(root, fields)
|
||||||
|
root.bind('<Return>', (lambda event, e=ents: fetch(e)))
|
||||||
|
b1 = Button(root, text='Show',
|
||||||
|
command=(lambda e=ents: fetch(e)))
|
||||||
|
b1.pack(side=LEFT, padx=5, pady=5)
|
||||||
|
b2 = Button(root, text='Quit', command=root.quit)
|
||||||
|
b2.pack(side=LEFT, padx=5, pady=5)
|
||||||
|
root.mainloop()
|
||||||
Loading…
Reference in New Issue
Block a user