0
我有一個代碼,打開一個word文檔並插入照片到它和東西。 GUI部分被證明是非常棘手的。我希望它可以拖放文檔,然後點擊確定,我已經工作的代碼將運行並使用從拖放功能獲得的文件名...如何從wx txtctrl打開文件名
我已經使用了代碼從這個線程:
Wxpython browse for or drag and drop folder
這部分特別:
class MyFrame(wx.Frame):
def __init__(self, parent,id):
wx.Frame.__init__(self,parent,id,'report maker', size=(300,200))
dt1 = MyFileDropTarget(self)
self.tc_files = wx.TextCtrl(self, wx.ID_ANY)
self.tc_files.SetDropTarget(dt1)
def notify(self, files):
"""Update file in testcontrol after drag and drop"""
self.tc_files.SetValue(files[0])
基本上我已經被拖(使用Win32)扔下一句話doc和希望從計劃中的其他地方打開它。我不確定如何打開拖放的文件。我試過很多東西沿着這條線...
doc = word.Documents.Open(notify(tc_files, files[0])
在此先感謝您的任何提示!