Building PyGTK- and poppler-based binaries under Windows - python

For quite some time now, I've been fighting in vain to get a software I'm working on to work under Windows. It's written in Python (the 2.x series), and although all Linux users can benefit from its GUI when they use the source package, it seems that many people who download it go for the Windows package, for which I've only been able to provide command-line binaries.
The GUI was built using Glade/GTK, and uses poppler to embed a PDF viewer. I've found various howto's in the past (I don't have them at hand right now, sorry), which I've tried to follow religiously, but I never got things to work at all.
So, is there a reliable tutorial explaining exactly how to install the needed libraries (GTK and Poppler), so that I can build the corresponding binaries for my users?

There is a window installer here: http://download.gnome.org/binaries/win32/pygtk/2.22/

Related

75 MB Helloworld with py2app !

I'm testing different languages to developp a desktop application for Mac&Windows.
I thought that Python+Wx worth a try so I wrote a simple hello world.
Then, I tried the py2app to package my application as a Mac application.
What a surprise to find that my hellworld.app weight as much as 75 MB !! (then I have an error at runtime but that's not the question)
Here is my question : is there a way to distribute a standalone wxPython application that weight less than a few MB ? (for instance, an adress book app).
(a Swing HelloWorld is around 3KB, plus around 20MB for the JRE)
Thank you
I would highly remmoend you using PyINstaller, which can be found here: link
it works like a chamr for me so far and it support most of the major libraries:
wxpython pyqt and even django (although i dont really understand the whole django support thing ;-) )
PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, and Mac OS X. Its main advantages over similar tools are that PyInstaller works with any version of Python since 2.2, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
The main goal of PyInstaller is to be compatible with 3rd-party packages out-of-the-box. This means that, with PyInstaller, all the required tricks to make external packages work are already integrated within PyInstaller itself so that there is no user intervention required. You'll never be required to look for tricks in wikis and apply custom modification to your files or your setup scripts. As an example, libraries like PyQt, Django or matplotlib are fully supported, without having to handle plugins or external data files manually. Check our compatibility list of SupportedPackages.
i hope this helps, good luck and tell if you need anymore help

Is there a Python editor with python built in?

I need an editor with python built into it. Currently I use blender so I do not have install python. Blender comes with the python32.dll to use python. is there another editor out there that I can execute python commands without it being installed?
I don't understand the question fully either. Why NOT install python? But if the question is how to be able to edit and run python on machines without installing it, there's Movable Python (http://www.voidspace.org.uk/python/movpy/) with a small fee to purchase and Portable Python (http://www.portablepython.com/wiki/About), free, donation requested. I've used Movable Python and can vouch for it. I've never tried Portable Python.
ViennaMike referenced Movable Python which has a small fee, after I had asked the question, I did more searching and found movable python about the same time he suggested it. I seems to find something different.
http://code.google.com/p/movable-python/
this seems to be a free version of movable python. This is only the IDLE portion of python, but can be used to run *.py files. It is considerably smaller than a normal python installation, and comes in a zip file.
Several people asked about my ability to install an editor but not python. At my High school (I work with the IT dept as one of my classes) I find python helps a lot with some tasks. I am unable to install python due to admin rights (which I will have next year) so anytime I did install python, because of its size on the Network drive, it would be automatically deleted.
Thank you ViennaMike again for finding movable python, unfortunately, it only works with python 2.5, so I may see if there is a way I can get that to 3.2

desktop development language compiled binary or scripting language (windows)?

Does anyone use a scripting language only solution to produce a binary (.exe) to produce a commercial desktop application for windows or mac? e.g. Java, python etc. If so how do you distribute your app and does using a scripting language cause any problems with the installation?
I'm asking about users that can download an application and install it, they don't know about setting path variables, or changing there JAVA_HOME. The assumption for the PC are users with a consumer PC with windows (XP/Vista/7), not power users. (Or alternatively a mac type solution would be interesting to hear about to)
I have done this in a couple ways. One was to use Python and py2exe, and the other was to use Idle, a Lua-based "compilable" language, using InnoSetup to create installers.
I have had no problems with either, though I haven't used Idle for anything of any significant complexity --- its main advantage is the small size of the executable produced. With py2exe, you have to be careful to get all the dependencies included in the package, and I recommend testing it thoroughly on a clean installation of Windows before releasing. For example, when I used PyGTK with py2exe, I had to be very careful to get the theming files included in the package. It was not evident at first that I had missed them, since PyGTK found them in the installed version on the development machine.
I also had to be careful about installation paths, permissions, and startup directories, as well as licensing of the libraries I used, but that's nothing you wouldn't have to be concerned with in a more traditional compiled language. Other than the relatively large size of the installer, I've been very happy with py2exe and InnoSetup, and I'd recommend it.
Does anyone use anything else for shrink wrap apps on windows? e.g. Java, python etc.
Yes. I assume you're not really asking about Java, since that is so wide-spread. I can count quite a few Java applications that I use, and I don't operate in the "Enterprise" environment.
There are tools that allow you to ship Python code without shipping actual .py files and without needing the to actually have Python installed, so there are solutions for that as well. Since such tools exist I assume people do ship Python applications.
If so how do you distribute your app and does using a scripting language cause any problems with the installation?
What scripting language?

Including python and other files

All of the python I've written so far have been fine on my own computer, but now I'd like to send some programs to friends to have them test certain features. Suppose I wrote an application in python with wxpython. Assuming people I send code to will not have either installed, what is the best way to include both python, and the wxpython library so the other person isn't struggling to get it running? I've never had to do this at this point in my learning and would love some feedback!
Thanks.
You can create a bundle using py2exe and installer using NSIS and ship it as executable so that your friend will get the complete working executable. But mind you, this will increase the size of the file enormously and I have often found it easier to ask them to install via README.txt files.
There are lots of binary builders: py2exe, cx_freeze, bbfreeze, PyInstaller, GUI2Exe. I have a whole slew of articles on these:
http://www.blog.pythonlibrary.org/2010/08/31/another-gui2exe-tutorial-build-a-binary-series/
http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/
http://www.blog.pythonlibrary.org/2010/08/19/a-bbfreeze-tutorial-build-a-binary-series/
http://www.blog.pythonlibrary.org/2010/08/12/a-cx_freeze-tutorial-build-a-binary-series/
http://www.blog.pythonlibrary.org/2010/08/10/a-pyinstaller-tutorial-build-a-binary-series/
Unless they are going to develop with Python too, then I don't see any reason for them to want to install a bunch of multi-megabyte installers versus your own. You can read about how to use Inno Setup to create an installer here:
http://www.blog.pythonlibrary.org/2008/08/27/packaging-wxpymail-for-distribution/

Installing a Python program on Linux

I wrote a Python program. I would like to add to it an installation script that will set up everything necessary - like desktop icon, entry in the menu, home directory file, etc.
I'm working on Linux (ubuntu). When a Python program is installed, what needs to happen in general? I know that it probably depends on the nature of the program.
Can you give me some general ideas? Or, point me in the right direction? I have no idea how to look for this on Google.
Thanks
If it's a Python program you're trying to package, you should consider using its 'standard' distribution framework distutils. I can't replicate the entire document here but I'd recommend that you read it. Once you're done with that, check out the Hitchhikers guide to packaging which contains details on distribute - the extensions to distutils that allow you to package and distribute more effectively.
You could create an rpm easily using checkinstall. Search for checkinstall in google and download it. It will allow you to create an rpm and set the options.
For Ubuntu if you want it to be easily distributable to other Ubuntu users it'll have to be packaged properly, which is no simple task. You might want to consult their Packaging Guide for more information.
Otherwise, generally speaking there are a few standard packaging options for Python. Setuptools is popular, but becoming reviled lately. Read James Bennett's blog post "On Packaging" for a decent in-depth look into the ups and downs of the Python packaging world.
How a program is launched and placed in the menu is determined by a .desktop file (you can read the specification or just look at some examples from /usr/share/applications). Properly installing a program (placing all files in the right directories and so on) requires either making a package like a deb or rpm, or you could use something like distutils or setuptools.
It may also help to just look at some (open source) examples of Python programs for Linux.

Categories