Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
750 B
1
Indexable
Never
import sys, os
from pathlib import Path
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt

class window(QWidget):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("program")
        self.setGeometry(100,100,400,300)

        layout = QVBoxLayout(self)

        file = sys.argv[0]
        pathname = os.path.dirname(file)
        path = Path(pathname)
        dosya = path / "image.jpg"

        label = QLabel("hi everyone")
        label.setStyleSheet(f"border-image:url('{dosya}');")
        label.setAlignment(Qt.AlignCenter)

        layout.addWidget(label)

if __name__ == "__main__":
    app = QApplication(sys.argv)
    win = window()
    win.show()
    sys.exit(app.exec_())