2016-04-29 113 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):