how do i avoid this issue in pyqt5?

You could use a custom signal. Create the signal in DragDrop and emit in dropEvent:

image_dropped = pyqtSignal(str)
def dropEvent(self, event):
    file_path = event.mimeData().urls()[0].toLocalFile()
    self.image_dropped.emit(file_path)

Connect the signal to showWin in Main:

def run(self):
    self.startWin=QWidget()
    self.setinfo()
    dnd=DragDrop('Drop Photo here',self.startWin)
    dnd.image_dropped.connect(self.showWin)
    self.startWin.show()
    sys.exit(app.exec_())

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top