0

I'm trying to make with Python an EXE/MSI of my script, but in my script I use the library tkinter.tix i use that to create a Balloon tooltip. If i execute the script with the IDLE runs very well, but if i try to make an EXE(auto-py-to-exe) or MSI(cx_Freeze), shows me an error.

I import the module like this:

from tkinter.tix import *

I attach the error in picture.

Tix Error

I appreciate you can help me!!! Thanks...

furas
  • 134,197
  • 12
  • 106
  • 148
  • This [question](https://stackoverflow.com/questions/70093591/pyinstaller-cant-find-package-tix) may help. – acw1668 Nov 30 '21 at 03:21
  • there are many similar questions on Stackoverflow and always is the same problem: Python wasn't created to build `.exe` and tools like `PyInstalle`, `cx_Freeze`, etc. may have problem to find all needed Python modules and C/C++ libraries - and then you have to add them manually to project. `PyInstaller` has special file `.spec` for this. In `PyInstaller` documentation you can find pages `"Using Spec File"` and `"What to do when something goes wrong"` – furas Nov 30 '21 at 06:43
  • your error shows that it can't filnd C/C++ library `libtix.8.1.8.3.so` or similar (because `.so` means library for `Linux`) - so you have to add this manually to project. Details you have to find in documentations. – furas Nov 30 '21 at 06:45

1 Answers1

0

You need to copy the tix folder in the Python installed folder into the distributed folder as well.

Below is a sample setup.py when cx_Freeze is used:

from cx_Freeze import setup, Executable

# change to the correct path for the tix folder in your system
include_files = [(r'C:\Python38\tcl\tix8.4.3', r'lib\tkinter\tix8.4.3')]

build_exe_options = {
    'include_files': include_files,
}

bdist_msi_options = {}

setup(
    name='Demo',
    version='0.1',
    options = {
        'build_exe': build_exe_options,
        'bdist_msi': bdist_msi_options,
    },
    executables=[Executable('tix-demo.py', base='Win32GUI')],
)

Then build the MSI by executing the following command:

python3 setup.py bdist_msi
acw1668
  • 40,144
  • 5
  • 22
  • 34