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])
在此先感谢您的任何提示!