-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.py
More file actions
49 lines (38 loc) · 1.12 KB
/
Copy pathmenu.py
File metadata and controls
49 lines (38 loc) · 1.12 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
from PyQt5.uic import loadUi
from PyQt5.QtWidgets import QApplication,QMessageBox ,QTableWidgetItem
import json
from pickle import load,dump
import subprocess
app = QApplication([])
w = loadUi('mainmenu.ui')
def displayHistory():
tab = w.table
F = open('history.dat','rb')
tab.setRowCount(0)
k = 0
while True:
try:
e = load(F)
tab.insertRow(k)
tab.setItem(k,0,QTableWidgetItem(str(e['date'])))
tab.setItem(k,1,QTableWidgetItem(str(e['score'])))
tab.setItem(k,1,QTableWidgetItem(str(e['time'])))
tab.setItem(k,3,QTableWidgetItem(str(e['speed'])))
k = k + 1
except:
F.close()
break
def start():
F = open('settings.json','w')
e = {}
e['radius'] = int(w.radius.text()) or 10
e['time'] = float(w.time.text()) or 30.0
e['fullscreen'] = w.fullscreen.isChecked() or False
json.dump(e,F)
F.close()
subprocess.run('python aimtrainer.py')
displayHistory()
w.refresh.clicked.connect(displayHistory)
w.start.clicked.connect(start)
w.show()
app.exec()