-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (27 loc) · 799 Bytes
/
main.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
import os
import sqlite3
import sys
from PySide2.QtWidgets import QApplication
from window import Start
def main():
app = QApplication(sys.argv)
_ = Start()
sys.exit(app.exec_())
def create_db():
rank = sqlite3.connect('rank.db')
c = rank.cursor()
for mode in ("Easy", "Medium", "Hard"):
c.execute("CREATE TABLE {}("
"id int primary key not null, "
"user text, "
"time real"
");".format(mode))
insert = "INSERT INTO {}(id, user, time) VALUES (?, ?, ?);".format(mode)
for i in range(1, 6):
c.execute(insert, (i, None, None))
rank.commit()
rank.close()
if __name__ == '__main__':
if not os.path.exists('rank.db'):
create_db()
main()