forked from jurasec/python-reportlab-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyqttest.py
More file actions
30 lines (23 loc) · 740 Bytes
/
Copy pathpyqttest.py
File metadata and controls
30 lines (23 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from PyQt5.QtWidgets import QMainWindow, QApplication
import sys
class MainWidget(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Drag photos to ")
self.setStyleSheet("QMainWindow {background: 'yellow';}")
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 = [u.toLocalFile() for u in event.mimeData().urls()]
for f in files:
print(f)
if __name__ == '__main__':
app = QApplication(sys.argv)
ui = MainWidget()
ui.show()
sys.exit(app.exec_())