简体   繁体   中英

Importing modules using Python in Abaqus script

I am trying to import the Tkinter module into my abaqus script so that I can create popup boxes. I have tried appending the directory and tried both Tkinter and tkinter (although the file is Tkinter.py , I checked) Here is my code. The path that I appended to is the folder where the Tkinter.py file is located. The error that I get says ImportError: No module named Tkinter

import sys
sys.path.append('C:\SIMULIA\Abaqus\6.12-3\tools\SMApy\Lib\lib-tk')
from Tkinter import *

'\\t' in Python represent TAB character, not a backslashed and t .

If you want to represnt backslash and t , you should escape the backslash, or should use raw string literal.

'C:\\SIMULIA\\Abaqus\\6.12-3\\tools\\SMApy\\Lib\\lib-tk'

or

r'C:\SIMULIA\Abaqus\6.12-3\tools\SMApy\Lib\lib-tk'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM