473,735 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

py2exe setup file for wxPython that runs from any IDE and excludes Tkinter

bartonc
6,596 Recognized Expert Expert
You can find the original author of the script by ggling " Py2Exe version 6.3 setup" The cool thing about this is that it calls py2exe, just in case you're uncomfortable with the command line. I had to search hi and lo for the example of how to exclude Tkinter. Coming soon: scipy includes and numpy include that gets rid of complaints of missing modules that are fantom errors.

Expand|Select|Wrap|Line Numbers
  1. # Py2Exe version 6.3 setup file for wxPython GUI programs.
  2. # Creates a single exe file.
  3. # It's easiest to add this wxPython2Exe.py file into the same
  4. # folder with the source file and an optional iconfile like "icon.ico"
  5. # (if you add your own icon file, remove the comment in front of icon_resources).
  6. # Simply change the filename to whatever you called your source file.
  7. # Optionally edit the version info and add the name of your icon file.
  8. # Now run wxPython2Exe.py ...
  9. # Two subfolders will be created called build and dist.
  10. # The dist folder contains your .exe file, MSVCR71.dll and w9xpopen.exe
  11. # Your .exe file contains your code, all neded modules and the Python interpreter.
  12. # The MSVCR71.dll can be distributed, but is often already in the system32 folder.
  13.  
  14. from distutils.core import setup
  15. import py2exe
  16. import sys
  17.  
  18. sys.path.append(r"D:\My Documents\HETAP Project\2.05a")
  19.  
  20.  
  21. # enter the filename of your wxPython code file to compile ...
  22. filename = "App1.pyw"
  23.  
  24. # ... this creates the filename of your .exe file in the dist folder
  25. if filename.endswith(".py"):
  26.     distribution = filename[:-3]
  27. elif filename.endswith(".pyw"):
  28.     distribution = filename[:-4]
  29.  
  30.  
  31. # if run without args, build executables in quiet mode
  32. if len(sys.argv) == 1:
  33.     sys.argv.append("py2exe")
  34.     sys.argv.append("-q")
  35.  
  36. class Target:
  37.     def __init__(self, **kw):
  38.         self.__dict__.update(kw)
  39.         # for the versioninfo resources, edit to your needs
  40.         self.version = "2.0.1"
  41.         self.company_name = "BCDesigns"
  42.         self.copyright = "no copyright"
  43.         self.name = "HETAP Pro 2.01a"
  44.  
  45. ################################################################
  46. # The manifest will be inserted as resource into your .exe.  This
  47. # gives the controls the Windows XP appearance (if run on XP ;-)
  48. #
  49. # Another option would be to store it in a file named
  50. # test_wx.exe.manifest, and copy it with the data_files option into
  51. # the dist-dir.
  52. #
  53. manifest_template = '''
  54. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  55. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  56. <assemblyIdentity
  57.     version="5.0.0.0"
  58.     processorArchitecture="x86"
  59.     name="%(prog)s"
  60.     type="win32"
  61. />
  62. <description>%(prog)s Program</description>
  63. <dependency>
  64.     <dependentAssembly>
  65.         <assemblyIdentity
  66.             type="win32"
  67.             name="Microsoft.Windows.Common-Controls"
  68.             version="6.0.0.0"
  69.             processorArchitecture="X86"
  70.             publicKeyToken="6595b64144ccf1df"
  71.             language="*"
  72.         />
  73.     </dependentAssembly>
  74. </dependency>
  75. </assembly>
  76. '''
  77.  
  78. RT_MANIFEST = 24
  79.  
  80. # description is the versioninfo resource
  81. # script is the wxPython code file
  82. # manifest_template is the above XML code
  83. # distribution will be the exe filename
  84. # icon_resource is optional, remove any comment and give it an iconfile you have
  85. #   otherwise a default icon is used
  86. # dest_base will be the exe filename
  87. test_wx = Target(
  88.     description = "A GUI app",
  89.     script = filename,
  90.     other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog=distribution))],
  91.     #icon_resources = [(1, "icon.ico")],
  92.     dest_base = distribution)
  93.  
  94. ################################################################
  95. packages = ["mx.ODBC.Windows"] #"scipy.signal", "numpy.core", "UniversalLibrary",
  96. includes = ["PMDDialog", "PMD"]
  97. excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon",
  98.             "pywin.dialogs", "pywin.dialogs.list",
  99.             "Tkconstants","Tkinter","tcl",
  100.             ]
  101.  
  102. setup(
  103.     options = {"py2exe": {"compressed": 1,
  104.                           "optimize": 2,
  105.                           "ascii": 1,
  106.                           "bundle_files": 1,
  107.                           "packages": packages,
  108. ##                          "includes": includes,
  109.                           "excludes": excludes}},
  110.  
  111.     zipfile = None,
  112.     windows = [test_wx],
  113.     )
  114.  
Mar 12 '07 #1
0 13471

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5723
by: Werner Merkl | last post by:
Hi, Python is really great, for small to big programs. For my colleagues and some circumstances I sometimes need to "compile" a script using py2exe. Cause I use Windows, I like to use the (Windows) ability, to add some version infos, comments, etc to the exe file. If I use explorer to check, these properties are visible and correct.
0
1530
by: Jimmy Retzlaff | last post by:
py2exe 0.6.4 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation. Console and Windows (GUI) applications, Windows NT services, exe and dll COM servers are supported. Changes in 0.6.4:
0
1517
by: Jimmy Retzlaff | last post by:
py2exe 0.6.5 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation. Console and Windows (GUI) applications, Windows NT services, exe and dll COM servers are supported. Changes in 0.6.5:
4
4011
by: bwaha | last post by:
First time trying to create an executable with py2exe. I have a small program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'), matplotlib ('0.83.2'), win32com (latest?), Numeric ('23.7') on Windows XP & Win2000. The program runs without problem but as an exe it doesn't even get to showing the GUI. I get the following error log when I run the executable. Traceback (most recent call last): File "mpival3.py", line 1264, in ?
3
2925
by: Jerry | last post by:
I have created an application using wxPython and compiled it using py2exe. When I put setup(console=) in my setup.py file, the resulting application runs just fine. But when I change it to setup(windows=)
0
1727
by: Jimmy Retzlaff | last post by:
py2exe 0.6.6 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation. Console and Windows (GUI) applications, Windows NT services, exe and dll COM servers are supported. Changes in 0.6.6:
1
2987
by: Jimmy Retzlaff | last post by:
py2exe 0.6.8 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation. Console and Windows (GUI) applications, Windows NT services, exe and dll COM servers are supported. Changes in 0.6.8:
0
1523
by: Larry Bates | last post by:
Jimmy Retzlaff wrote: Everyone, Thanks for all your hard work on py2exe, it is greatly appreciated. -Larry Bates
0
3121
by: Jimmy Retzlaff | last post by:
py2exe 0.6.9 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation. Console and Windows (GUI) applications, Windows NT services, exe and dll COM servers are supported. Changes in 0.6.9:
0
8964
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8786
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9466
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9327
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9201
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2740
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.