0

I am building an app with tkinter, cx_freeze and I have Anaconda installed. The app is taking a really long time to open (30 seconds). I think it has something to do with the tzdata that is in the ananconda tcl folders as I can see it opening these up when I ran a process monitor on it. If I delete these from my anaconda folders, will this break anything? Is there a way around this?

from cx_Freeze import setup, Executable
import os.path
base = None    
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')


executables = [Executable("RunExcelMacro.py", base=base)]

packages = ["idna","tkinter","os","win32com.client"]
options = {
    'build_exe': {    
        'packages':packages,'include_files':[
            os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
            os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
         ],
    },    
}


#os.environ['TCL_LIBRARY'] = r'C:\ProgramData\Anaconda3\tcl\tcl8.6'
#os.environ['TK_LIBRARY'] = r'C:\ProgramData\Anaconda3\tcl\tk8.6'
setup(
    name = "Background Excel Executor",
    options = options,
    version = "1.0",
    description = 'Runs an excel macro in the background',
    executables = executables
)
Mike Clark
  • 33
  • 7
  • Just some practical advice, you don't have to delete them, you could just move them, try, and move them back if something breaks. I'm guessing something will break, but worth a shot. – mVChr Sep 17 '18 at 20:53
  • However, doing a little research there are a lot of complaints about tkinter being slow. You might want to try [PySide](https://wiki.qt.io/PySide). – mVChr Sep 17 '18 at 20:55
  • @mVChr Tkinter works just fine. I have several Tkinter based apps that I have converted to an exe with freeze. I think it is more likely a problem with Anaconda. Anaconda is notorious for having issues due to most of its libraries having some custom tweaks. Really the OP should probably build their app in good'ol Python and just pip in the libraries he needs manually. This should help prevent issues like this as the OP would have the latest Python and libraries unlike Anaconda. – Mike - SMT Sep 18 '18 at 11:55
  • @Mike Yeah I really think it has to do with Anaconda, although I also tried it with pyinstaller and it was a much faster load. Since I have Anaconda installed, how would I build these in only Python? I'm still somewhat new to Python. – Mike Clark Sep 18 '18 at 23:00
  • @mVChr It looks like PySide has some compatibility issues with Python 3? – Mike Clark Sep 18 '18 at 23:02
  • PyInstaller may not have the same bug. It could just be a freeze/anaconda issues. – Mike - SMT Sep 18 '18 at 23:18

0 Answers0