Facebook
From KULA, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 122
  1. import sys
  2. from PySide6.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout,
  3.                                QHBoxLayout, QLabel, QLineEdit, QPushButton,
  4.                                QComboBox, QSpacerItem, QSizePolicy)
  5.  
  6. class MainWindow(QMainWindow):
  7.     def __init__(self):
  8.         super().__init__()
  9.  
  10.         # Central widget and layout
  11.         central_widget = QWidget()
  12.         self.setCentralWidget(central_widget)
  13.         main_layout = QVBoxLayout(central_widget)
  14.  
  15.         # Horizontal layout for class selection, inputs, and button
  16.         horizontal_layout = QHBoxLayout()
  17.  
  18.         # Class selection (Wybierz klasę)
  19.         class_selection_label = QLabel("Wybierz klasę:")
  20.         class_selection_combo = QComboBox()
  21.         class_selection_combo.addItems(["2TD", "2TP", "3TF", "3TP"])
  22.         class_selection_layout = QVBoxLayout()
  23.         class_selection_layout.addWidget(class_selection_label)
  24.         class_selection_layout.addWidget(class_selection_combo)
  25.  
  26.         # Middle layout for inputs
  27.         inputs_layout = QVBoxLayout()
  28.  
  29.         # Name input (Podaj nazwisko)
  30.         name_input_label = QLabel("Podaj nazwisko:")
  31.         name_input_edit = QLineEdit()
  32.         inputs_layout.addWidget(name_input_label)
  33.         inputs_layout.addWidget(name_input_edit)
  34.  
  35.         # Password input (Podaj hasło)
  36.         password_input_label = QLabel("Podaj hasło:")
  37.         password_input_edit = QLineEdit()
  38.         password_input_edit.setEchoMode(QLineEdit.Password)
  39.         inputs_layout.addWidget(password_input_label)
  40.         inputs_layout.addWidget(password_input_edit)
  41.  
  42.         # Button (DALEJ)
  43.         submit_button = QPushButton("DALEJ")
  44.         submit_button.setStyleSheet("font-weight: bold;")  # Bold font for the button
  45.         button_layout = QVBoxLayout()
  46.         button_layout.addWidget(submit_button)
  47.         button_layout.addItem(QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding))  # Add space below button
  48.  
  49.         # Add class selection, inputs, and button to the horizontal layout
  50.         horizontal_layout.addLayout(class_selection_layout)
  51.         horizontal_layout.addLayout(inputs_layout)
  52.         horizontal_layout.addLayout(button_layout)
  53.  
  54.         # Add the horizontal layout to the main layout
  55.         main_layout.addLayout(horizontal_layout)
  56.  
  57.         # Set window title and size
  58.         self.setWindowTitle("Belka Tytułowa")
  59.         self.resize(600, 200)  # Adjust the size as needed to match the design
  60.  
  61. if __name__ == '__main__':
  62.     app = QApplication(sys.argv)
  63.     window = MainWindow()
  64.     window.show()
  65.     sys.exit(app.exec())
  66.