Layout steht.
This commit is contained in:
+32
-1
@@ -1,5 +1,8 @@
|
||||
import os
|
||||
from PySide6.QtWidgets import QMainWindow
|
||||
from src.ui.MainWinddow_ui import Ui_MainWindow
|
||||
from PySide6.QtGui import QPixmap
|
||||
# from PySide6.QtCore import Qt
|
||||
from ui.MainWinddow_ui import Ui_MainWindow
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
@@ -16,9 +19,37 @@ class MainWindow(QMainWindow):
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
# Bilder korrekt laden
|
||||
self._load_images()
|
||||
|
||||
# Signale und Slots verbinden
|
||||
self._connect_signals()
|
||||
|
||||
def _load_images(self):
|
||||
"""Lädt die Bilder mit absoluten Pfaden."""
|
||||
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# Absolute Pfade zu den Bildern erstellen
|
||||
img1_path = os.path.join(base_dir, "src", "ui", "res", "graf_1.gif")
|
||||
img2_path = os.path.join(base_dir, "src", "ui", "res", "graf_3.gif")
|
||||
|
||||
print(repr(self.ui.label), img2_path)
|
||||
|
||||
# Bilder setzen, wenn die Dateien existieren
|
||||
if os.path.exists(img1_path):
|
||||
self.ui.label.setPixmap(QPixmap(img1_path).scaledToWidth(200))
|
||||
self.ui.label_3.setPixmap(QPixmap(img1_path))
|
||||
else:
|
||||
self.ui.label.setText(f"Fehler: Bild nicht gefunden: {img1_path}")
|
||||
self.ui.label_3.setText(f"Fehler: Bild nicht gefunden: {img1_path}")
|
||||
|
||||
if os.path.exists(img2_path):
|
||||
self.ui.label_2.setPixmap(QPixmap(img2_path).scaledToWidth(200))
|
||||
self.ui.label_4.setPixmap(QPixmap(img2_path))
|
||||
else:
|
||||
self.ui.label_2.setText(f"Fehler: Bild nicht gefunden: {img2_path}")
|
||||
self.ui.label_4.setText(f"Fehler: Bild nicht gefunden: {img2_path}")
|
||||
|
||||
def _connect_signals(self):
|
||||
"""Verbindet Signale mit den entsprechenden Slots."""
|
||||
# Beispiel für Signal-Verbindung:
|
||||
|
||||
Reference in New Issue
Block a user