You need to create a wrapper for this and get a version of the binary file that you can use. I built this for use with Python 3.4 and copied it to tkribbon1.0-x86_64.zip . You must unzip it in the Python / tcl subdirectory so that the tcl version used by python can load it.
The minimum shell looks like this:
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()
Running this use uses the resources built into the tkribbon dll and looks like
. A complex bit will receive some tape markup resources in the DLL to load.
You can use this example to download feeds from existing applications. For example, python Ribbon.py c:\Windows\System32\mspaint.exe MSPAINT_RIBBON load the tape resource from mspaint. The resource name should be included in this case, since APPLICATION_RIBBON is used by default. For your own feed, using uicc to create the .rc file, then rc /r file.rc to create the .res file, and finally link -dll -out:file.dll file.rc -noentry -machine:AMD64 seems to be works to create a resource DLL that works with this extension.