wx.DirDialog ボックス内で GetPath を介して変数 (snowDIR) を作成しましたが、関数の外で snowDIR を使用したいと考えています。私のコードのサンプルがあります:
for file in os.listdir(snowDIR):
if fnmatch.fnmatch(file, '*.hdf'):
if file[9:16] == a:
inputhdf = (snowDIR + '\\' + file)
print 'input hdf is: ', inputhdf
tmod = 1
def OnDownload(self, e):
modisPathFile = 'MODIS_data_directory_path.txt'
dlg = wx.DirDialog(self, "Choose a directory:",
style=wx.DD_DEFAULT_STYLE
#| wx.DD_DIR_MUST_EXIST
#| wx.DD_CHANGE_DIR
)
if dlg.ShowModal() == wx.ID_OK:
print "You chose %s" % dlg.GetPath()
snowDIR = dlg.GetPath()
print 'snowDIR : ', snowDIR
dlg.Destroy()
more code ....
return snowDIR
ロックせずにネットを検索して時間がなくなったので、どんな助けも大歓迎です。