Search code examples
pythontkintersvgthemesttk

tkinter ttk theme: _tkinter.TclError: image file format "svg" is not supported


I tried out this ttk theme, that uses svg images. But it says image file format svg isn't supported.

On this line:

root.tk.call('source','./DATA/themes/sun-valley-dark.tcl')

this error is raised:

Traceback (most recent call last):
  File "guitesting.py", line 141, in <module>
    root.tk.call('source','./DATA/themes/sun-valley-dark.tcl')
_tkinter.TclError: image file format "svg" is not supported

Useful information:

OS: Windows 7
Python: Python 3.8.10
Architecture: x86 (32-bit)
Tkinter version: 8.6

Solution

  • install tksvg via pip: python -m pip install tksvg

    add at the top of the file

    import tksvg
    

    And

    tksvg.load(root)
    root.tk.call('source','./DATA/themes/sun-valley-dark.tcl')