-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.py
66 lines (49 loc) · 1.64 KB
/
template.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
from PyQt5 import QtGui
from PyQt5.QtCore import QThread
from PyQt5.QtGui import QPalette, QColor
from PyQt5.QtWidgets import QMainWindow, QApplication
class Model:
def __init__(self):
pass
class Controller:
def __init__(self):
self.model = Model()
self.view = View(self)
self.view.show()
self.isNewGame = True
def newGame(self):
self.model = Model()
self.isNewGame = True
self.view.update()
class View(QMainWindow):
def __init__(self, controller):
super().__init__()
self.controller = controller
self.setWindowTitle("Game")
meanBar = self.menuBar()
startMenu = meanBar.addMenu("Start")
# startMenu.addAction("New game", self.newGame, "Ctrl+N")
startMenu.addAction("Quit", self.close, "Ctrl+Q")
self.setMenuWidget(meanBar)
self.setFixedSize(640, 640 + 30)
# self.setWindowFlags(Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint)
self.setAutoFillBackground(True)
palette = QPalette()
palette.setColor(QPalette.Background, QColor("#B1723C"))
self.setPalette(palette)
def paintEvent(self, a0: QtGui.QPaintEvent):
pass
def keyPressEvent(self, a0: QtGui.QKeyEvent):
pass
def keyReleaseEvent(self, a0: QtGui.QKeyEvent):
pass
def mouseMoveEvent(self, a0: QtGui.QMouseEvent):
pass
def mousePressEvent(self, a0: QtGui.QMouseEvent):
pass
def mouseReleaseEvent(self, a0: QtGui.QMouseEvent):
pass
if __name__ == '__main__':
app = QApplication([])
game = Controller()
app.exit(app.exec_())