我想使用gtk drag& drop获取已删除文件的名称。这是代码:
[...]
self.scrolledwindow_play.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY)
self.scrolledwindow_play.connect('drag_data_received', self.on_drag_data_received_to_play)
self.scrolledwindow_play.drag_dest_set_target_list(None)
self.scrolledwindow_play.drag_dest_add_text_targets()
def on_drag_data_received_to_play(self, widget, drag_context, x,y, data,info, time):
print data.get_text()
当我拖动文件并放入小部件时,我会:
像这样{p>file:///home/mnrl/Masa%C3%BCst%C3%BC/spinbutton.py
。但真正的文件路径是:
file:///home/mnrl/Masaüstü/spinbutton.py
为什么编码字符不同?我如何正确地获取文件路径?
答案 0 :(得分:0)