スクリプトやウィジットの格納されるフォルダを取得

ウィジットでPythonスクリプト実行時に、スクリプトの実体ファイルが配置されるフォルダをスクリプトから取得します。


import os.path

docPath = xshade.shade().user_shade_doc_path
scriptsPath = os.path.join(docPath, 'Scripts')

print scriptsPath

実行すると、「C:\Users\ユーザ名\Documents\Shade3D\Shade3D Ver.20\Scripts」のように、
ドキュメントフォルダ内のShade3Dのスクリプト格納フォルダが取得されます。

同様に、ウィジットの格納されるフォルダは以下のように取得できます。


import os.path

docPath = xshade.shade().user_shade_doc_path
widgetsPath = os.path.join(docPath, 'Widgets')

print widgetsPath
この記事のURLとタイトルをコピーする
Translate »