Created
April 28, 2015 12:18
-
-
Save peace098beat/db8ef7161508e6500ebe to your computer and use it in GitHub Desktop.
[PyQt] Drag and Drop files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
I was looking for exactly this. Thanks!
Simple and Useful!
Lots of thanks.
thank you very much
❤️ ❤️ ❤️
👍
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
👍