from PyQt5.QtWidgets import QApplication, QDialog, QFileDialog from PyQt5.uic import loadUi import sys, os, re from pathlib import Path import pandas as pd from icecream import ic import numpy as np import json import logging class A2CSV(QDialog): # erbt von QDialog def __init__(self): # super (MainUI, self).__init__() #Aufrufen des Konstruktors von QDialog super().__init__() loadUi("AM2CSV.ui", self) self.pB_open.clicked.connect(self.open_file_dialog) self.filename = None self.onlyfilename = None self.path = None def open_file_dialog(self): self.filename, _ = QFileDialog.getOpenFileName(self,"Aufbaumaster","\\Volumes\\Daten01\\Documents\\toCSV","Images (*.xls *.xlsx *.xlsb)") #self.lblCMDBPath.setText(self.filename) if self.filename: self.path = Path(self.filename) self.onlyfilename = os.path.basename(self.filename) self.lb_selected_aufbaumaster.setText(self.onlyfilename) if __name__ == "__main__": app = QApplication(sys.argv) ui = A2CSV() ui.show() app.exec_()