[Pygui] Distributing a PyGUI application on Windows.
Mark Melvin
mark.melvin at gmail.com
Fri Apr 15 01:09:00 CEST 2011
I had issues as well. I found that this setup.py works for me. I also had
to import the PyGUI modules specially in my main script as follows:
from GUI.Buttons import Button
from GUI.RadioGroups import RadioGroup
from GUI.RadioButtons import RadioButton
from GUI.Labels import Label
from GUI.CheckBoxes import CheckBox
from GUI.Frames import Frame
from GUI.Applications import Application
from GUI.Menus import Menu
from GUI.MenuLists import MenuList
from GUI.Windows import Window
from GUI.Sliders import Slider
from GUI.Colors import rgb
from GUI.Resources import resource_path, find_resource
from GUI.FileDialogs import request_old_file
from GUI.Files import FileRef, FileType, DirRef
Here are the contents of my setup.py file:
# Build an executable for my_script.
#
import sys
import os
# Yet another *hack* to get py2exe to work. It can't seem to find
# win32com.shell.
# ModuleFinder can't handle runtime changes to __path__, but win32com uses
them
try:
# py2exe 0.6.4 introduced a replacement modulefinder.
# This means we have to add package paths there, not to the built-in
# one. If this new modulefinder gets integrated into Python, then
# we might be able to revert this some day.
# if this doesn't work, try import modulefinder
try:
import py2exe.mf as modulefinder
except ImportError:
import modulefinder
import win32com
for p in win32com.__path__[1:]:
modulefinder.AddPackagePath("win32com", p)
for extra in ["win32com.shell"]: #,"win32com.mapi"
__import__(extra)
m = sys.modules[extra]
for p in m.__path__[1:]:
modulefinder.AddPackagePath(extra, p)
except ImportError:
# no build path setup, no worries.
pass
from distutils.core import setup
import py2exe
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ("msvcp71.dll",
"dwmapi.dll", "mfc71.dll"):
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
################################################################
# If run without args, build executables, in quiet mode.
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
class Target:
def __init__(self, **kw):
self.__dict__.update(kw)
# for the versioninfo resources
self.version = "1.0.0"
self.company_name = "My Company"
self.copyright = "Copyright 2011 Me. All rights reserved."
self.name = "My Script"
my_script = Target(
# used for the versioninfo resource
description = "A cool description",
# what to build
script = "my_script.py",
dest_base = "my_script")
setup(
options = {"py2exe": {"compressed": 1,
"optimize": 2,
"ascii": 1,
"bundle_files": 3,
"packages" : ['GUI', 'encodings'],
}},
zipfile = None,
windows = [my_script]
)
I hope this helps.
Regards,
Mark.
On Thu, Apr 14, 2011 at 6:46 PM, Devon Meunier <devon.meunier at gmail.com>wrote:
> I have similar issues with py2exe.
>
> On Thu, Apr 14, 2011 at 5:59 PM, Vernon Cole <vernondcole at gmail.com>
> wrote:
> > Try http://www.py2exe.org/
> > If that does not work, get back to us on this list.
> > Vernon Cole
> >
> > On Thu, Apr 14, 2011 at 1:59 PM, Devon Meunier <devon.meunier at gmail.com>
> > wrote:
> >>
> >> Hello all,
> >>
> >> I've written a simple application in PyGUI, and I'm wondering how best
> >> to distribute this to Windows users who do not have Python, Pywin32,
> >> or PyGUI installed. Normally, I would use cx_freeze to produce an
> >> .exe, but it appears to be unable to load PyGUI. Thoughts? Options?
> >>
> >> Thanks,
> >>
> >> Devon
> >> _______________________________________________
> >> Pygui mailing list
> >> Pygui at python.org
> >> http://mail.python.org/mailman/listinfo/pygui
> >
> >
> _______________________________________________
> Pygui mailing list
> Pygui at python.org
> http://mail.python.org/mailman/listinfo/pygui
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pygui/attachments/20110414/538a5a61/attachment.html>
More information about the Pygui
mailing list