0

I am using tkinter in Python 3.5 to create a snap app in Ubuntu 16.04. However, I am getting an error. The code goes like this :

import tkinter as tk

class InitialWin(tk.Toplevel):
    ...

root = tk.Tk() 
win = InitialWin(root)

After building the snap and installing it, I am getting an error upon run:

Traceback (most recent call last):
  File "/snap/minimal-snip/x12/bin/minimal-snip", line 488, in 
<module>
    win = InitialWin(root)
  File "/snap/minimal-snip/x12/bin/minimal-snip", line 45, in __init__
    foreground='#FFFFFF')
  File "/snap/minimal-snip/x12/usr/lib/python3.5/tkinter/__init__.py", 
line 2212, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "/snap/minimal-snip/x12/usr/lib/python3.5/tkinter/__init__.py", 
line 2142, in __init__
    (widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: failed to allocate font due to internal system font 
engine problem

Initially, I was getting a error which I solved by referring to this question. But now, I am getting this error. Please suggest a solution.

  • Do you know what font it is trying to use, and whether it is installed on the system where you are running this? – Donal Fellows Aug 05 '17 at 06:27
  • The python program (.py file) runs just fine when I execute it normally. This error only occurs when I build the snap using the 'snapcraft prime' command. The font I am using is the default one offered by tkinter. I haven't chosen any font explicitly to be used in my program. – Kushal Chauhan Aug 06 '17 at 07:16
  • In that case it sounds like a snapcraft bug. The fonts used by Tkinter are standard system ones; it uses the `fontconfig` library to locate them and the `Xfd` library to render them. – Donal Fellows Aug 06 '17 at 08:16

0 Answers0