DiscreteMathematics/Lab_3/main.py

95 lines
3.4 KiB
Python
Raw Permalink Normal View History

2024-03-09 17:44:57 +02:00
from PyQt5 import QtCore, QtWidgets
import sys
import window_2
class Window(QtWidgets.QMainWindow):
def __init__(self):
super(QtWidgets.QMainWindow, self).__init__()
self.window_2 = window_2.Window()
self.setWindowTitle("Вікно 1")
centralwidget = QtWidgets.QWidget(self)
self.grid_layout = QtWidgets.QGridLayout(centralwidget)
self.full_name = QtWidgets.QLabel(centralwidget)
self.full_name.setText("П. І. Б:")
self.full_name.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.grid_layout.addWidget(self.full_name, 0, 0, 1, 1)
self.full_name_answer = QtWidgets.QLabel(centralwidget)
self.full_name_answer.setText("Швед Андрій Дмитрович")
self.grid_layout.addWidget(self.full_name_answer, 0, 1, 1, 1)
self.group = QtWidgets.QLabel(centralwidget)
self.group.setText("Група:")
self.group.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.grid_layout.addWidget(self.group, 1, 0, 1, 1)
self.group_answer = QtWidgets.QLabel(centralwidget)
self.group_answer.setText("ІО-23")
self.grid_layout.addWidget(self.group_answer, 1, 1, 1, 1)
self.list_number = QtWidgets.QLabel(centralwidget)
self.list_number.setText("Номер в списку:")
self.list_number.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.grid_layout.addWidget(self.list_number, 2, 0, 1, 1)
self.list_number_answer = QtWidgets.QLabel(centralwidget)
self.list_number_answer.setText("30")
self.grid_layout.addWidget(self.list_number_answer, 2, 1, 1, 1)
self.task_number = QtWidgets.QLabel(centralwidget)
self.task_number.setText("Номер завдання:")
self.task_number.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
self.grid_layout.addWidget(self.task_number, 3, 0, 1, 1)
self.task_number_answer = QtWidgets.QLabel(centralwidget)
self.task_number_answer.setText("1")
self.grid_layout.addWidget(self.task_number_answer, 3, 1, 1, 1)
self.setCentralWidget(centralwidget)
self.menubar = QtWidgets.QMenuBar(self)
self.menubar.setGeometry(QtCore.QRect(0, 0, 362, 22))
self.menubar.setDefaultUp(False)
self.menu_Windows = QtWidgets.QMenu(self.menubar)
self.menu_Windows.setTitle("Вікна")
self.setMenuBar(self.menubar)
self.window_2_action = QtWidgets.QAction(self)
self.window_2_action.setText("Вікно 2")
self.menu_Windows.addAction(self.window_2_action)
self.menu_Windows.addSeparator()
self.exit_action = QtWidgets.QAction(self)
self.exit_action.setText("Вихід")
self.menu_Windows.addAction(self.exit_action)
self.menubar.addAction(self.menu_Windows.menuAction())
self.set_menu()
QtCore.QMetaObject.connectSlotsByName(self)
def set_menu(self):
self.exit_action.triggered.connect(lambda: sys.exit())
self.window_2_action.triggered.connect(lambda: self.window_2.show())
app = QtWidgets.QApplication(sys.argv)
app.setStyleSheet(open("style.css").read())
window = Window()
window.show()
sys.exit(app.exec_())