컴퓨터/Python 코딩

4. Drag and Drop

아브아카 2017. 10. 4. 07:57

파일을 GUI 요소로 드래그 앤 드롭하여 그림파일을 읽어오는 예제이다. 주석도 잘 나와있어 예제만으로 충분한 듯.



여기서 Drag and Drop 구현할때 필요한 부분은


self.setAcceptDrops(True)


드롭 받는 부분을 True로 만들어주어야함.


def dragEnterEvent(self, e):


def dragMoveEvent(self, e):


def dropEvent(self, e):


요 세부분에 대한 내용을 자신의 프로그램에 맞게 변형해야함.


참고 : http://www.birving.com/blog/2015/09/29/drag-and-drop-files-into-gui-using/