1

So I've been working a while on a tkinter program that kills windows explorer and pulls up a dialogue box with an image, button, and canvas.

So I got the python script itself to work. But when I try to compile it with cx_Freeze for use on my other 64 bit windows computer, and then run it, nothing happens. No errors, no dialogue messages, nothing. Just a loading animation over the cursor for a few seconds before it stops.

I made a batch file that pauses the application before it finishes in hopes of finding an error that I may have missed:

my-application-name.exe %1

PAUSE

This gave me no info on what might be preventing this program to work.

So my question is, since there is no obvious solution, when a tkinter python application doesn't work at all and behaves like this, where in the code would I look to find the cause of it not working? It has to be in the setup.py file I used for cx_Freeze, since the Python script works without it, right?

Here is my setup.py code used to compile with cx_Freeze:

import sys, os
from cx_Freeze import setup, Executable

base = None
if sys.platform == 'win32':
  base = 'Win32GUI'

os.environ['TCL_LIBRARY'] = 
r'C:\Users\jbond\AppData\Local\Programs\Python\Python36\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = 
r'C:/Users/jbond/AppData/Local/Programs/Python/Python36/tcl/tk8.6'


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

setup(name='simple_Tkinter',
    version='0.1',
    description='Sample cx_Freeze Tkinter script',
    executables=executables
    )

Thanks for any help.

WeimTime
  • 11
  • 2
  • 1
    I'll bet you failed to include the `mainloop()` call. – Novel Jan 09 '18 at 22:41
  • 2
    We'll need to see your code, or at least a [mcve] if you want any help with that. – Novel Jan 09 '18 at 22:43
  • I would use `print()` to display values in variables and which part of code is executed. – furas Jan 09 '18 at 23:20
  • @Novel Ha ha.. No it's there. Like I said the Tkinter application works inside of Python just fine and everything with it. It's when I compile it with CX_Freeze that it does nothing. And as far as I know, mainloop () calls aren't supposed to be in the setup.py file. – WeimTime Jan 09 '18 at 23:44
  • @Novel Hmm I'll post some, sure. But the reason I didn't post the initial script with everything in it is because that works. I tested on a computer with Python, then I compiled it in 32 bit with cx_Freeze and it works that way too. However when I try for a 64 bit application using cx_freeze (after switching over all the modules and python itself to 64 bit) it will compile without errors (after a lot of work) but it won't run correctly. – WeimTime Jan 09 '18 at 23:49
  • @Novel continued... However, if you think that's where I ought to look for a solution instead of in the setup.py file, I'll be sure to post that code in a bit here after I try what others are recommending first, and we can look through it together. – WeimTime Jan 09 '18 at 23:49
  • Try putting your entry point inside a try/except statement, then log any error messages to a file. That should give you a hint as to what cx_freeze is missing. – Jack Taylor Oct 12 '18 at 23:19

0 Answers0