2

I am trying to package a Python Tkinter app using cx-freeze on a Mac using bdist_mac. Everything compiles, but the actual GUI shows up as a black screen (even though the widgets are still there because I can click on them). I've attached my setup.py and a sample Tkinter app.

Edit: Added 'os' to packages and deleted tkinter from includes--still no progress.

Not sure if this says anything, but I tried bdist_mac and bdist_dmg -- neither created a.dmg or .app file.

setup.py:

PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tk8.6')

# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages=['_sysconfigdata_m_darwin_darwin', 'cairocffi', 'cairosvg', 'tkinter', 'os'], includes=[], excludes=[],
                    include_files=['/Users/celinaperalta/Documents/NYLTesting/rally-exports/', os.path.join(PYTHON_INSTALL_DIR, 'libtcl8.6.dylib'), os.path.join(PYTHON_INSTALL_DIR, 'libtk8.6.dylib')])

import sys
base = 'Win32GUI' if sys.platform=='win32' else None

executables = [
    Executable('Test.py', base=base)
]

setup(name='RallyReportTool',
      version = '1.0',
      description = 'For use within New York Life CRM team',
      options = dict(build_exe = buildOptions),
      executables = executables)

Test.py:

from tkinter import *

def main():

    window = Tk()

    window.title("Welcome to Test app")

    lbl = Label(window, text="Hello")

    lbl.grid(column=0, row=0)

    window.mainloop()


if __name__ == "__main__":
    main()

0 Answers0