May-22-2023, 01:18 PM
Hi,
as required, I started a new thread.
I'm very sorry for asking again, but unfortunately I can not handle this...
Could you please help me again?
This was an example without the created class "MyWindow()" that I managed (but that you probably won't like):
But I'm guessing...:
as required, I started a new thread.
I'm very sorry for asking again, but unfortunately I can not handle this...
Could you please help me again?
This was an example without the created class "MyWindow()" that I managed (but that you probably won't like):
from PyQt6.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout, QVBoxLayout import sys app = QApplication([]) window = QWidget() window.setWindowTitle("Py App") window.setGeometry(100, 100, 200, 200) bA = QPushButton("A") bB = QPushButton("B") bC = QPushButton("C") layout = QHBoxLayout() layout.addWidget(bA) layout.addWidget(bB) layout.addWidget(bC) bD = QPushButton("D") bE = QPushButton("E") bF = QPushButton("F") layout2 = QVBoxLayout() layout2.addWidget(bD) layout2.addWidget(bE) layout2.addWidget(bF) layout.addLayout(layout2) window.setLayout(layout) window.show() sys.exit(app.exec())I tried to create the attributes layout and layout2 from the class "MyWindow()"
But I'm guessing...:
class MyWindow(): def __init__(self, layout, layout2): self.layout = layout self.layout2 = layout2 super().__init__() # make all the widgets labelThreshold = QLabel() labelThreshold.setText("erlaubter Unterschied für gleiche Bilder (threshold):") textboxThreshold = QLineEdit() textboxThreshold.setText(str(0)) labelMinCount = QLabel() labelMinCount.setText("kleinster Hänger, der gefunden wird (Anzahl Bilder, min_count):") textboxMinCount = QLineEdit() textboxMinCount.setText(str(5)) layout = QVBoxLayout() layout.addWidget(labelThreshold) layout.addWidget(textboxThreshold) layout.addWidget(labelMinCount) layout.addWidget(textboxMinCount) layout2 = QHBoxLayout() layout2.addWidget(button_HF_Start) layout2.addWidget(button_close) layout.addLayout(layout2) button_HF_Start = QPushButton("Hängerfinder ausführen") button_close = QPushButton("schließen") button_HF_Start.clicked.connect(self.start_processing) button_close.clicked.connect(self.close) def start_processing(self): # called when startbutton is clicked # check if film is marked with x in excel pH = "C:\hangerfinder\S8-Hanger_Positionen.xlsm" fileXLSX = openpyxl.load_workbook(pH, keep_vba=True) sheet = fileXLSX["Blatt"] r = 2 xOcurrence = 0 for c in range(2, 82, 4): if sheet.cell(r, c).value == "x": xOcurrence = 1 if xOcurrence == 0: ctypes.windll.user32.MessageBoxW(0, "Please mark the film to be checked for hangers in excel with an ""X"".", "You forgot something...", 1) sys.exit() begin = time.time() all_frames = os.listdir(p) threshold = textboxThreshold.text() min_count = textboxMinCount.text() hangers = detect_hangers(phash_iter(all_frames), int(threshold), int(min_count)) numberOfHangers = len(hangers) fill_hanger_information_in_excel(hangers, numberOfHangers) end = time.time() def close(self): quit() def main(): # Is not executed when file is imported app = QApplication([]) window = MyWindow() app.exec() #window.close() #window.setWindowTitle("hangerfinder") #window.setGeometry(100, 100, 200, 200) if __name__ == "__main__": main()I'm sorry that I'm not so experienced in this...