55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
|
|
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])
|
|
|