Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
2.8 kB
2
Indexable
Never
import sys
from PyQt6.QtWidgets import QApplication, QWidget, QLabel
from PyQt6.QtGui import QFont, QPixmap


class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.initializeUI()

    def initializeUI(self):
        self.setGeometry(50, 50, 250, 460)
        self.setWindowTitle("2.1 - GUI Profil użytkownika")
        self.setUpMainWindow()
        self.show()

    def createImageLabels(self):
        images = ["images/skyblue.png", "images/profile_image.png"]
        for image in images:
            try:
                with open(image):
                    label = QLabel(self)
                    pixmap = QPixmap(image)
                    label.setPixmap(pixmap)
                    if image == "images/profile_image.png":
                        label.move(80, 20)
            except FileNotFoundError as error:
                print(f"Ni ma obrazu \n Błąd: {error}")

    def setUpMainWindow(self):
        self.createImageLabels()
        user_label = QLabel(self)
        user_label.setText("John Smith")
        user_label.setFont(QFont("Arial", 20))
        user_label.move(50, 140)
        bio_label = QLabel(self)
        bio_label.setText("Biografia")
        bio_label.setFont(QFont("Arial", 17))
        bio_label.move(15, 180)
        about_label = QLabel(self)
        about_label.setText(
            "Jestem Inżynierem Oprogramowania z 10-letnim doświadczeniem w tworzeniu niesamowitego kodu.")
        about_label.setWordWrap(True)
        about_label.move(15, 220)
        skill_label = QLabel(self)
        skill_label.setText("Umiejętności")
        skill_label.setFont(QFont("Arial", 17))
        skill_label.move(15, 280)
        language_label = QLabel(self)
        language_label.setText("Python | PHP | SQL | JavaScript")
        language_label.move(15, 320)
        experience_label = QLabel(self)
        experience_label.setText("Doświadczenie")
        experience_label.setFont(QFont("Arial", 17))
        experience_label.move(15, 350)
        developer_label = QLabel(self)
        developer_label.setText("Programista Python")
        developer_label.move(15, 390)
        devDates_label = QLabel(self)
        devDates_label.setText("Mar 2011 - Obecnie")
        devDates_label.setFont(QFont("Arial", 10))
        devDates_label.move(25, 405)
        driver_label = QLabel(self)
        driver_label.setText("Dostawca Pizzy")
        driver_label.move(15, 430)
        driverDates_label = QLabel(self)
        driverDates_label.setText("Sie 2015 - Gru 2017")
        driverDates_label.setFont(QFont("Arial", 10))
        driverDates_label.move(25, 445)


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MainWindow()
    sys.exit(app.exec())
Leave a Comment