Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlinkCountFeature #897

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions BlinkCount/BlinkCount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 23 18:04:23 2020

@author: DiogoBranco
"""


import tkinter as tk
from tkinter import filedialog
import csv

root=tk.Tk()
root.title("Blinks")

root.resizable(0, 0)


def addFile():
Dirname=filedialog.askopenfile(mode ='r', filetypes =[('Comma Separated Files', '*.csv')])
#print(Dirname)
Dirname=str(Dirname)
Dirname=Dirname.replace("<_io.TextIOWrapper name='",'')
Dirname=Dirname.replace("' mode='r' encoding='cp1252'>",'')
#print(Dirname)



blinks=[]
with open(Dirname, newline='') as csvfile:
data = csv.DictReader(csvfile)
for row in data:
blinks.append(row[' AU45_c'])


a=0
numberofblinks=0
while a!=len(blinks)-1:

b=a+1

if blinks[a]== ' 1.00' and blinks[b] == ' 0.00':
numberofblinks=numberofblinks+1
a=a+1

#print("Number of blinks: ",numberofblinks)

popupmsg("Number of blinks: "+str(numberofblinks))






def popupmsg(msg):
popup = tk.Tk()
popup.wm_title("!")
label = tk.Label(popup, text=msg)
label.pack(anchor= "center", fill="x", pady=10)
B1 = tk.Button(popup, text="Close", command = popup.destroy)
B1.pack()
popup.mainloop()



canvas=tk.Canvas(root, height=100, width=200, bg="black")
label1 =tk.Label(root,text="Select a .csv file", bg="white")
canvas.create_window(100,50,window=label1)
canvas.pack()

openFile=tk.Button(root,text ="Select File", padx=50,pady=5,fg="white",bg="#263D42",command=addFile)
openFile.pack()
root.mainloop()









33 changes: 33 additions & 0 deletions BlinkCount/BlinkCount.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['BlinkCount.py'],
pathex=['C:\\Users\\DiogoBranco\\Desktop\\BlinkCount'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='BlinkCount',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False )
Binary file added BlinkCount/__pycache__/BlinkCount.cpython-37.pyc
Binary file not shown.
Loading