-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestgui.py
71 lines (60 loc) · 2.33 KB
/
testgui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import Tkinter
from Tkinter import *
import tkMessageBox
root = Tkinter.Tk()
frame = Frame(root)
frame.pack()
label = Label(frame, text='Mice Detector GUI', fg = 'red')
label.pack(side = TOP)
sensorLabel = Label(root, text = 'RFid Sensors', fg = 'blue')
sensorLabel.pack(side = LEFT)
SensorText = Text(root, height = 4)
SensorText.insert(INSERT,'RFid Sensor 1 status...' + '(show status here)\n')
SensorText.insert(INSERT,'RFid Sensor 2 status...' + '(show status here)\n')
SensorText.pack()
middleFrame = Frame(root)
middleFrame.pack(side = BOTTOM)
code = 'hi'
miceLabel = Label(middleFrame, text = 'Mice states', fg = 'green')
miceLabel.pack(side = LEFT)
MiceText = Text(middleFrame, height = 10)
MiceText.insert(INSERT, 'Mice 1 state: ' + 'home' + '\n' + 'Mice 2 state: ' + 'home' +
'\n' + 'Mice 3 state: ' + 'home' + '\n')
#MiceText.insert(INSERT, 'Mice 2 state... ' + '(state)\n')
#MiceText.insert(INSERT, 'Mice 3 state... ' + '(state)\n')
MiceText.pack()
path = 'log.txt'
file = open(path, 'r')
message = file.read()
MiceText.insert("1.0", message + '\n')
def task():
file = open(path, 'r')
message = file.read()
file.close
if(message == '6164996'):
MiceText.delete("1.0", END)
MiceText.insert(INSERT, 'Mice 1 state: ' + 'tube' + '\n' + 'Mice 2 state: ' + 'home' +
'\n' + 'Mice 3 state: ' + 'home' + '\n')
if(message == '12919161'):
MiceText.delete("1.0", END)
MiceText.insert(INSERT, 'Mice 1 state: ' + 'home' + '\n' + 'Mice 2 state: ' + 'home' +
'\n' + 'Mice 3 state: ' + 'tube' + '\n')
if(message == '8657565'):
MiceText.delete("1.0", END)
MiceText.insert(INSERT, 'Mice 1 state: ' + 'home' + '\n' + 'Mice 2 state: ' + 'tube' +
'\n' + 'Mice 3 state: ' + 'home' + '\n')
if(message == '6164996e'):
MiceText.delete("1.0", END)
MiceText.insert(INSERT, 'Mice 1 state: ' + 'test place' + '\n' + 'Mice 2 state: ' + 'home' +
'\n' + 'Mice 3 state: ' + 'home' + '\n')
if(message == '12919161e'):
MiceText.delete("1.0", END)
MiceText.insert(INSERT, 'Mice 1 state: ' + 'home' + '\n' + 'Mice 2 state: ' + 'home' +
'\n' + 'Mice 3 state: ' + 'test place' + '\n')
if(message == '8657565e'):
MiceText.delete("1.0", END)
MiceText.insert(INSERT, 'Mice 1 state: ' + 'home' + '\n' + 'Mice 2 state: ' + 'test place' +
'\n' + 'Mice 3 state: ' + 'home' + '\n')
root.after(1000, task)
#root.after(1000,task)
root.mainloop()