Skip to content

Instantly share code, notes, and snippets.

@peace098beat
Created April 28, 2015 12:18
Show Gist options
  • Save peace098beat/db8ef7161508e6500ebe to your computer and use it in GitHub Desktop.
Save peace098beat/db8ef7161508e6500ebe to your computer and use it in GitHub Desktop.
[PyQt] Drag and Drop files
class MainWidget(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWidget, self).__init__(parent)
self.setWindowTitle("FiFiFactory App")
self.resize(720,480)
self.setAcceptDrops(True)
def dragEnterEvent(self, event):
if event.mimeData().hasUrls():
event.accept()
else:
event.ignore()
def dropEvent(self, event):
files = [unicode(u.toLocalFile()) for u in event.mimeData().urls()]
for f in files:
print f
Copy link

ghost commented Oct 28, 2022

thank you very much

@jonmatthis
Copy link

❤️ ❤️ ❤️

@Timtti
Copy link

Timtti commented Aug 27, 2023

👍

@unknown-kel
Copy link

how can i set it to a particular label or frame

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment