-
Notifications
You must be signed in to change notification settings - Fork 1
/
sidebar.py
41 lines (31 loc) · 1.18 KB
/
sidebar.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
from PyQt5.QtWidgets import QWidget, QLabel, QFrame
from PyQt5.QtCore import Qt
from moveTable import MoveTable
class Sidebar(QWidget):
def __init__(self, parent, w, h, x):
super().__init__(parent)
self.x = x
self.y = 0
self.w = w
self.h = h
self.setGeometry(self.x, self.y, self.w, self.h)
self.createPlayerLabel()
self.createMoveTable()
def update(self):
self.playerLabel.setText(f"Player {self.parent().currentPlayer.number}")
def createPlayerLabel(self):
self.playerLabel = QLabel(self)
self.playerLabel.setGeometry(10, 10, self.w - 20, self.h - 450)
self.playerLabel.setAlignment(Qt.AlignCenter)
self.playerLabel.setStyleSheet("font-size: 36pt; border: 4px solid black;")
self.playerLabel.setText(f"Player {self.parent().currentPlayer.number}")
self.playerLabel.show()
def createMoveTable(self):
self.moveTable = MoveTable(
self,
self.playerLabel.x(),
self.playerLabel.height() + 20,
self.playerLabel.width(),
self.h - self.playerLabel.height() - 30
)
self.moveTable.show()