-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStatus_Ocupancy.py
More file actions
66 lines (55 loc) · 3.09 KB
/
Copy pathStatus_Ocupancy.py
File metadata and controls
66 lines (55 loc) · 3.09 KB
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
# -*- coding: utf-8 -*-
from Tkinter import *
from PIL import ImageTk, Image
class OCCUPANCY:
def __init__(self, master):
self.master = master
self.val_Sit = StringVar()
self.val_Sta = StringVar()
self.val_Tot = StringVar()
self.val_Lyi = StringVar()
self.pro_sta = StringVar()
self.val_Sit.set('Number of standing people:')
self.val_Sta.set('Number of sitting people:')
self.val_Tot.set('Total number of people:')
self.val_Lyi.set('Number of lying people:')
self.pro_sta.set('Projector is:')
self.Occupancy_Frame = LabelFrame(master, bg = 'white', text = 'Room Status', font = ("Helvetica", 16), width = 600, heigh = 200)
self.Occupancy_Frame.pack_propagate(0)
self.Occupancy_Frame.pack(fill = None, expand = False, side = LEFT, anchor = NW, padx = 10, pady = 10)
self.Occupancy_Values = Frame(self.Occupancy_Frame, bg = 'white', bd = 0, padx = 10)
self.Occupancy_Values.pack(fill = None, expand = False, side = LEFT, anchor = W)
self.Label_Tota = Label(self.Occupancy_Values, bg = 'white', font = ("Helvetica", 14), textvariable = self.val_Tot )
self.Label_Sitt = Label(self.Occupancy_Values, bg = 'white', font = ("Helvetica", 14), textvariable = self.val_Sit )
self.Label_Stan = Label(self.Occupancy_Values, bg = 'white', font = ("Helvetica", 14), textvariable = self.val_Sta )
self.Label_Lyin = Label(self.Occupancy_Values, bg = 'white', font = ("Helvetica", 14), textvariable = self.val_Lyi )
self.Label_Proj = Label(self.Occupancy_Values, bg = 'white', font = ("Helvetica", 14), textvariable = self.pro_sta )
self.Label_Tota.pack(anchor = W)
self.Label_Sitt.pack(anchor = W)
self.Label_Stan.pack(anchor = W)
#self.Label_Lyin.pack(anchor = W)
self.Label_Proj.pack(anchor = W)
#Icon related
self.Ocup_Icon = Frame(self.Occupancy_Frame, bg = 'white', bd = 2)
self.Ocup_Icon.pack(side = TOP)
self.ImgIcon = ImageTk.PhotoImage(Image.open('JPG/meeting.jpg'))
self.panel = Label(self.Ocup_Icon, image = self.ImgIcon, borderwidth=0)
self.panel.pack()
def update(self, Total, Sitting, Standing, Lying):
self.val_Tot.set('Total number of people: %d' % Total)
self.val_Sit.set('Number of standing people: %d'% Standing)
self.val_Sta.set('Number of sitting people: %d' % Sitting)
self.val_Lyi.set('Number of lying people: %d' % Lying)
if Lying > 0:
self.ImgIcon = ImageTk.PhotoImage(Image.open('JPG/emergency.jpg'))
self.panel.config(image = self.ImgIcon)
return 0
def SetPro(self, Status):
self.pro_sta.set('Projector is: %s'%Status)
if Status == 'ON':
self.ImgIcon = ImageTk.PhotoImage(Image.open('JPG/projector.jpg'))
self.panel.config(image = self.ImgIcon)
else:
self.ImgIcon = ImageTk.PhotoImage(Image.open('JPG/meeting.jpg'))
self.panel.config(image = self.ImgIcon)
return 0