如果我直接运行这个脚本(使用python命令),它可以在32位和64位python3.3.3安装中使用。 我的任务是集成企业版和扩展版。在
下面是我的源代码和错误截图。在
import win32com.client
import pythoncom
import ctypes
import sys
from tkinter import *
import glob
import shutil
import sys
import os
from tkinter import filedialog
class Application():
def __init__(self, master=None):
mGui = Tk()
mGui.geometry('400x80')
mGui.title('Choose the template directory ')
mEntry = Entry(mGui,width=50,state="readonly",font=("Arial", 8,"bold")).grid(row=0,column=0,padx=(15),pady=(15))
mButton = Button(mGui,text='Browse',font=("Arial", 8,"bold")).grid(row=0,column=1)
mButton = Button(mGui,text='Save',font=("Arial", 8,"bold")).grid(row=1,column=0,padx=(15),pady=(2))
mGui.mainloop()
class EAAddin():
_public_methods_ = ['EA_FileOpen', 'EA_GetMenuItems', 'EA_MenuClick']
_reg_progid_ = "EAAddin"
_reg_clsid_ = pythoncom.CreateGuid()
def EA_FileOpen(self, repo_obj):
"Callback EA_FileOpen"
repo = win32com.client.Dispatch(repo_obj)
print("ConnectionString = ", repo.ConnectionString)
def EA_GetMenuItems(self, repo_obj, menuLocation, menuName):
"Callback EA_GetMenuItems"
if menuName == "":
return "-EAAddin"
else:
menuOptions=[]
menuOptions.append("Export")
menuOptions.append("Templates Path")
return menuOptions
def EA_MenuClick(self, repo_obj, menuLocation, menuName, itemName):
"Callback EA_MenuClick"
app = Application()
if __name__ == "__main__":
print("Registering COM server...")
try:
import win32com.server.register
win32com.server.register.UseCommandLine(EAAddin)
except BaseException:
print(BaseException)
64位版本的屏幕截图如下。 我点击加载项
结果-
32位版本的屏幕截图如下。 我点击加载项
结果-
如果有什么需要我做的,请告诉我。在
目前没有回答
相关问题 更多 >
编程相关推荐