2016-04-29 115 views
1

在abaqus脚本编写过程中遇到问题。我正在尝试在abaqus scipt中使用tkinter。当我运行我的第一次代码的程序运行正常,但是当我运行我的程序,第二次,然后用ABAQUS以下错误退出: “意外LoadlibraryA错误193 ipc_CONNECTION_BROKEN”在Abaqus中导入tkinter时出错

我使用ABAQUS 6.14与Python 2.7 与英特尔Paralllal Stuido XE 2015年作曲家版64位更新运行2

我的插件类,如下所示:

from abaqusGui import getAFXApp, Activator 
from abaqusConstants import ALL 
import os 
thisPath = os.path.abspath(__file__) 
thisDir = os.path.dirname(thisPath) 
toolset = getAFXApp().getAFXMainWindow().getPluginToolset() 
toolset.registerGuiMenuButton(
    buttonText='Pilot GUI', 
    object= Activator(os.path.join(thisDir, 'pilotDB.py')), 
    kernelInitString='' 
) 

我pilotDB类看起来是这样的:

class pilotDB:  
import Tkinter 
root = Tkinter.Tk() 
app = pilotDB(root) 
root.mainloop() 
root.quit() 

回答

0

我已经找到了解决办法: 的问题是,当我第一次封闭,在右上角的X上的传统知识的窗口,应用程序无法销毁窗口正常,所以当我开始应用的第二次,它坠毁。解决方案: 下面的代码添加到我的pilotDB类:

def shutdown_ttk_repeat(self): 
    self.mainroot.eval('::ttk::CancelRepeat') 
    self.mainroot.destroy() 

,然后摧毁protokol增加的“初始化”功能pilotDB类开始

def __init__(self, parent): 
    self.mainroot=parent 
    self.mainroot.protocol("WM_DELETE_WINDOW", self.shutdown_ttk_repeat):