-
Notifications
You must be signed in to change notification settings - Fork 5
/
multiType.py
104 lines (88 loc) · 3.61 KB
/
multiType.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
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import QTimer
import random, math
from time import time
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName(_fromUtf8("Form"))
Form.resize(800, 600)
self.label = QtGui.QLabel(Form)
self.label.setGeometry(QtCore.QRect(170, 310, 50, 14))
self.label.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);"))
self.label.setObjectName(_fromUtf8("label"))
#self.q = 0
#self.finish_para = 0
#Add progress bar
self.progressBar = QtGui.QProgressBar(Form)
self.progressBar.setGeometry(QtCore.QRect(680, 0, 121, 23))
self.progressBar.setMinimumSize(QtCore.QSize(118, 23))
self.progressBar.setStyleSheet(_fromUtf8("color: rgb(0, 0, 50);"))
self.progressBar.setObjectName(_fromUtf8("progressBar"))
self.progressBar.setProperty("value", 0)
self.progressBar.setMinimum(0)
self.progressBar.setMaximum(5)
#Add text box
self.timeToStart = QtGui.QTextEdit(Form)
self.timeToStart.setGeometry(QtCore.QRect(80, 40, 111, 31))
self.timeToStart.setObjectName(_fromUtf8("timeToStart"))
self.timeToStart.setReadOnly(True)
self.timeToStart.setText(" Start in ")
# Add show text paragraph
self.showPara = QtGui.QTextEdit(Form)
self.showPara.setGeometry(QtCore.QRect(170, 130, 581, 161))
self.showPara.setObjectName(_fromUtf8("showPara"))
self.showPara.setReadOnly(True)
# Add Edit text box
self.editPara = QtGui.QTextEdit(Form)
self.editPara.setGeometry(QtCore.QRect(170, 325, 581, 161))
self.editPara.setObjectName(_fromUtf8("editPara"))
self.editPara.setReadOnly(True)
#if self.finish_para == 0:
#self.editPara.textChanged.connect(self.text_changed)
self.label_2 = QtGui.QLabel(Form)
self.label_2.setGeometry(QtCore.QRect(170, 110, 81, 16))
self.label_2.setStyleSheet(_fromUtf8("color: rgb(0, 0, 49);"))
self.label_2.setObjectName(_fromUtf8("label_2"))
# add Ok button
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
Form.setWindowTitle(_translate("Form", "Game TypeRacer", None))
self.label.setText(_translate("Form", "Type Here", None))
self.label_2.setText(_translate("Form", "Your Paragraph", None))
#self.finish.setText(_translate("Form", "Finish", None))
#self.Cancel.setText(_translate("Form", "Cancel", None))
#function to update progress bar
def update_progressbar(self, val):
self.progressBar.setValue(val)
if val == 5:
self.timeToStart.setText("Go..Game will start ")
self.timeToStart.setStyleSheet("QTextEdit {color:green}")
#function to directly close App
def closeApp(self):
print "Cancel pressed"
app.exit()
#function to start game in 5sec
def tick(self):
print "self"
print "tick"
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
Audio = QtGui.QMainWindow()
ui = Ui_Form()
ui.setupUi(Audio)
Audio.show()
sys.exit(app.exec_())