-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
55 lines (44 loc) · 1.53 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import sys
from PyQt5.QtWidgets import QPushButton, QLabel
from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog
from PyQt5.QtGui import QIcon
import os
from sudoku import Board
from detection import Detection
class App(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Sudoku")
self.displayWidth = 300
self.displayHeight = 400
self.setGeometry(200, 200, self.displayWidth, self.displayHeight)
self.setFixedSize(self.size())
self.choose()
def choose(self):
self.manBtn = QPushButton("Enter Grid Manually", self)
self.manBtn.move(self.displayWidth//2-70, self.displayHeight//2-60)
self.manBtn.resize(150, 40)
self.manBtn.clicked.connect(self.manualInput)
self.fileBtn = QPushButton("Choose File", self)
self.fileBtn.resize(150, 40)
self.fileBtn.move(self.displayWidth//2-70, self.displayHeight//2)
self.fileBtn.clicked.connect(self.fileInput)
def manualInput(self):
self.close()
Board()
def fileInput(self):
global the_file
the_chosen_image = QFileDialog.getOpenFileName(
self, "Select File", "", "*.png *.jpg")
the_file = the_chosen_image[0]
Detection(the_file)
for i in range(9):
for j in range(9):
Board.matrix[j][i] = Detection.board[i][j]
self.close()
Board()
if __name__ == '__main__':
app = QApplication(sys.argv)
win = App()
win.show()
sys.exit(app.exec_())