diff --git a/graphic_components/menu_graphics.py b/graphic_components/menu_graphics.py index c410d08..d6b0097 100644 --- a/graphic_components/menu_graphics.py +++ b/graphic_components/menu_graphics.py @@ -4,7 +4,7 @@ This module contains the components that make up the menu Board from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont from PyQt5.QtWidgets import (QSizePolicy, QGraphicsWidget, QGraphicsItem, - QGraphicsLineItem, QGraphicsRectItem, QGraphicsObject, + QGraphicsLineItem, QGraphicsRectItem, QGraphicsObject, QWidget, QGraphicsLinearLayout, QGraphicsLayoutItem, QGraphicsScene, QGraphicsView,) from PyQt5.QtCore import (QAbstractAnimation, QObject, QPointF, Qt, QRectF, QLineF, QPropertyAnimation, pyqtProperty, pyqtSignal, QSizeF, QTimer) @@ -207,6 +207,7 @@ class HighScoreDisplayer(QGraphicsObject): self.prepareGeometryChange() self.size = self.icon_size + if __name__ == "__main__": app = 0 app = QApplication(sys.argv) diff --git a/graphic_components/scoreboard.py b/graphic_components/scoreboard.py new file mode 100644 index 0000000..cb3c576 --- /dev/null +++ b/graphic_components/scoreboard.py @@ -0,0 +1,69 @@ +from PyQt5.QtGui import QPainter, QBrush, QPen, QColor, QFont +from PyQt5.QtWidgets import (QWidget, QLineEdit, QHBoxLayout, QGridLayout, QVBoxLayout, + QPushButton, QLabel) +from PyQt5.QtCore import (QAbstractAnimation, QObject, QPointF, Qt, QRectF, QLineF, + QPropertyAnimation, pyqtProperty, pyqtSignal, QSizeF, QTimer) +from PyQt5.Qt import QApplication +import sys + +class HighScoreBoard(QWidget): + + def __init__(self): + super().__init__() + + self.layout = QVBoxLayout(self) + self.layout.addLayout(DifficultySwitch()) + self.layout.addLayout(ScoreGrid()) + self.layout.addWidget(NameInput()) + + +class DifficultySwitch(QHBoxLayout): + + def __init__(self): + super().__init__() + + left_btn = QPushButton('<') + difficulty_display = QLabel('Normal') + right_btn = QPushButton('>') + + self.addWidget(left_btn) + self.addWidget(difficulty_display) + self.addWidget(right_btn) + + +class ScoreGrid(QGridLayout): + + def __init__(self): + super().__init__() + + for i in range(5): + label = QLabel(str(i)+'.') + self.addWidget(label, i, 0) + + for i, name in enumerate('ABCDE'): + label1 = QLabel(name) + label2 = QLabel('0') + self.addWidget(label1, i, 1) + self.addWidget(label2, i, 2) + + +class NameInput(QWidget): + + def __init__(self): + super().__init__() + + self.layout = QHBoxLayout(self) + + self.layout.addWidget(QLabel('Name')) + + self.name_input = QLineEdit(self) + self.layout.addWidget(self.name_input) + + +if __name__ == '__main__': + app = 0 + app = QApplication(sys.argv) + + ex = HighScoreBoard() + ex.show() + sys.exit(app.exec_()) \ No newline at end of file