3

I am building a tkinter GUI for a friend in Python 3.8.3 on a Mac running macOS Catalina 10.15.2 and trying to freeze it using cx_freeze 6.1.

When I run the python application in my local environment the application works perfectly. (screenshot: tkinter GUI in local environment)

When I package the application using cx_freeze and try to run the Linux executable the tkinter window opens but it is all black and I cannot see anything in it (screenshot: tkinter GUI after packaging with cx_freeze)

My setup.py file is below, I run it using the command python3 setup.py build. Is there something I am missing in the file? Or does anyone know if it is a bug? I have tried running the executable directly in Terminal and there are no errors. Thank you!

from cx_Freeze import setup, Executable
import os.path
import sys

# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(
    packages=["numpy", "os", "sympy", "sys", "tkinter"],
    includes=[],
    excludes=[],
    include_files=[],
    # replace_paths=[("*", "")],
    path=sys.path + ["lib"],
)

base = "Win32GUI" if sys.platform == "win32" else None

executables = [Executable("main.py", base=base)]
setup(
    name="NR Method Solver",
    version="1.0",
    description="A calculator to solves equation(s) with one or two unknown variables.",
    options=dict(build_exe=buildOptions),
    executables=executables,
)

This is my repo if anyone wants to view the whole code base https://github.com/gazelle51/nr-solver.

gazelle51
  • 31
  • 5
  • Disable dark mode on Mac and try again. I'm guessing this problem is related to the Tcl/Tk version 8.6.8 which has some issues getting a black screen similar to that of your screenshot. Either you disable dark mode or Run this ` defaults delete -g NSRequiresAquaSystemAppearance` command in terminal and restart. Refer to this [answer](https://stackoverflow.com/a/55516222/10364425), this could solve your problem. – Saad May 19 '20 at 07:20

0 Answers0