python - 'Font not defined' in Tkinter application freezed by cx_Freeze -
i have freezed tkinter-using gui python 3.4 app cx_freeze , when tried run it, presented following error:
nameerror: name 'font' not defined.
when remove references font code (i. e., if don't set ttk label fonts anywhere in code), works fine , exe runs nicely. have checked library.zip archive created freeze script , contain font.pyc file in tkinter directory. setup.py file looks like:
import cx_freeze import sys import tkinter base = none if sys.platform == 'win32': base = "win32gui" executables = [cx_freeze.executable("rocnikovka.py", base=base)] cx_freeze.setup( name = "number evolution", options = {"build_exe": {"packages":["tkinter", "tkinter.font"], "includes": ["tkinter", "tkinter.font"]}}, version = "0.01", description = "rocnikovka", executables = executables )
any appreciated.
update: have tried making executable out of script py2exe ended same result. seems problem tkinter rather cx_freeze.
update #2: import tkinter , ttk in script this:
from tkinter import * tkinter import ttk
i have few fonts defined in script, one:
font_title = font.font(family = "exo 2", size = 20, weight = "bold")
which use font parameter of ttk.label objects.
this works fine when run script in idle.
thanks arden, able work adding explicit font sub-module import:
from tkinter import font
works now.
Comments
Post a Comment