使用Tkinter的Python功能区应用程序
我想使用Python Tkinter创建一个功能区样式的应用程序 patthoyts回答的以下线程中的包装器似乎工作得很好:使用Tkinter的Python功能区应用程序,python,visual-studio,dll,tkinter,ribbon,Python,Visual Studio,Dll,Tkinter,Ribbon,我想使用Python Tkinter创建一个功能区样式的应用程序 patthoyts回答的以下线程中的包装器似乎工作得很好: 然而,我正在努力为自己的功能区设计创建.dll。我使用Visual Studio 2017的插件导出了功能区项目草稿的dll。RibbonWinForms似乎工作得很好 用我导出的dll替换从patthoyts(第一个链接)下载的dll(并相应地重命名文件)不起作用,并产生错误(_tkinter.TclError:找不到符号“Tkribbon_Init”)。 我已经
from tkinter import Widget
from os import path
class Ribbon(Widget):
def __init__(self, master, kw=None):
self.version = master.tk.call('package','require','tkribbon')
self.library = master.tk.eval('set ::tkribbon::library')
Widget.__init__(self, master, 'tkribbon::ribbon', kw=kw)
def load_resource(self, resource_file, resource_name='APPLICATION_RIBBON'):
"""Load the ribbon definition from resources.
Ribbon markup is compiled using the uicc compiler and the resource included
in a dll. Load from the provided file."""
self.tk.call(self._w, 'load_resources', resource_file)
self.tk.call(self._w, 'load_ui', resource_file, resource_name)
if __name__ == '__main__':
import sys
from tkinter import *
def main():
root = Tk()
r = Ribbon(root)
name = 'APPLICATION_RIBBON'
if len(sys.argv) > 1:
resource = sys.argv[1]
if len(sys.argv) > 2:
name = sys.argv[2]
else:
resource = path.join(r.library, 'libtkribbon1.0.dll')
r.load_resource(resource, name)
t = Text(root)
r.grid(sticky=(N,E,S,W))
t.grid(sticky=(N,E,S,W))
root.grid_columnconfigure(0, weight=1)
root.grid_rowconfigure(1, weight=1)
root.mainloop()
main()
在你的问题中,你没有提出任何实际问题。目前,除了“请免费修复我的代码”之外,你还不清楚在这里需要什么帮助。请明确说明您的问题。我添加了问号以使问题更清晰。添加了其他清晰问题。我不希望任何人修复我的代码,请帮助我理解它为什么不起作用,以便我可以修复它。