forked from fridlington/K11Consult
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimportSingleDial.py
112 lines (65 loc) · 2.65 KB
/
importSingleDial.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/python
# importSingleDial.py
#Copyright (C) 2014 Eilidh Fridlington http://eilidh.fridlington.com
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>
import os
import sys
import time
import dials as dd
import pygame
from pygame.locals import *
#dd.Dials(positionX=150)
os.environ['SDL_VIDEO_WINDOW_POS'] = 'center'
size = width, height = 400, 400
pygame.display.set_caption('K11Consult: %s' % __file__)
monitorX = pygame.display.Info().current_w
monitorY = pygame.display.Info().current_h
surface1FullscreenX = (monitorX / 2) - 150
surface1FullscreenY = (monitorY / 2) - 150
surface1WindowedX = (width / 2) - 150
surface1WindowedY = (height / 2) -150
surface1X = surface1WindowedX
surface1Y = surface1WindowedY
screen = pygame.display.set_mode(size)
surface1 = pygame.Surface((300,300))
surface1.set_colorkey(0x0000FF)
screen.fill(0x000000)
TEMP_Value = 1
TEMP_Max_Value = 140
while True:
pygame.time.Clock().tick(60)
for event in pygame.event.get():
if event.type==pygame.QUIT:
sys.exit()
pygame.quit()
if event.type is KEYDOWN and event.key == K_q:
sys.exit()
pygame.quit()
if event.type is KEYDOWN and event.key == K_w:
pygame.display.set_mode(size)
surface1X = surface1WindowedX
surface1Y = surface1WindowedY
screen.fill(0x000000)
if event.type is KEYDOWN and event.key == K_f:
pygame.display.set_mode((monitorX,monitorY), FULLSCREEN)
surface1X = surface1FullscreenX
surface1Y = surface1FullscreenY
screen.fill(0x000000)
surface1.fill(0x000000)
dd.Dials(maximumValue=(TEMP_Max_Value/10),endPosition=45,startPosition=-45,dialLabel='Temperature',displayCircle=True,dialType=dd.degree,needleDestination=surface1,needleValue=TEMP_Value,foregroundColour=(255,255,255),backgroundColour=(0,0,81))
screen.blit(surface1,(surface1X,surface1Y))
#time.sleep(0.08)
if TEMP_Value < TEMP_Max_Value:
TEMP_Value = TEMP_Value + 1
else:
TEMP_Value = 1
pygame.display.update()