Search code examples
pythontkinterpy2app

Py2app problems


I have created a python script that uses a tkinter GUI, I have tried to package it using py2app, My problem is that i dont know how to include the tkinter module. I have tried packaging my script without the module but all i get is a console message saying "ImportError: no module named tkinter"


Solution

  • The following setup.py script should do the trick for a basic Tkinter based script (replace 'hello.py' by the name of the actual script).

    from setuptools import setup
    
    setup(
        app=['hello.py'],
        setup_requires=["py2app"],
    )
    

    This is the setup.py script from py2app's hello_tk example

    UPDATE:

    You mention later on that tkinter cannot be imported from "outside" the py2app'd application either, and that the _tkinter extension (_tkinter.so) doesn't exist. That means that something is wrong with your installation of Python 3.3.