Create a portable version of a python installation on windows

I tested this on the following environvent:

Windows 7 32 SP1 and Windows XP 32 SP2
Python for Windows (cPython) :Windows x86 MSI Installer (2.7.6)

Copy the file c:\windows\System32\python27.dll to the folder of the python installation (e.g. c:\Python27)

Python needs the Microsoft.VC90.CRT manifest and three dll files to run.

Go to the python installation folder.
Create the folder Microsoft.VC90.CRT
Create a new textfile in this folder and open it.
Copy & paste the following text to the file and save it as Microsoft.VC90.CRT.manifest

<?xml version=“1.0″ encoding=“UTF-8″ standalone=“yes“?>
<assembly xmlns=“urn:schemas-microsoft-com:asm.v1″ manifestVersion=“1.0″>
<assemblyIdentity type=“win32″ name=“Microsoft.VC90.CRT“ version=“9.0.21022.8″ processorArchitecture=“x86″ publicKeyToken=“1fc8b3b9a1e18e3b“></assemblyIdentity>
<file name=“msvcr90.dll“ hashalg=“SHA1″ hash=“e0dcdcbfcb452747da530fae6b000d47c8674671″><asmv2:hash xmlns:asmv2=“urn:schemas-microsoft-com:asm.v2″ xmlns:dsig=““><dsig:Transforms><dsig:Transform Algorithm=“urn:schemas-microsoft-com:HashTransforms.Identity“></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=“″></dsig:DigestMethod><dsig:DigestValue>KSaO8M0iCtPF6YEr79P1dZsnomY=</dsig:DigestValue></asmv2:hash></file> <file name=“msvcp90.dll“ hashalg=“SHA1″ hash=“81efe890e4ef2615c0bb4dda7b94bea177c86ebd“><asmv2:hash xmlns:asmv2=“urn:schemas-microsoft-com:asm.v2″ xmlns:dsig=““><dsig:Transforms><dsig:Transform Algorithm=“urn:schemas-microsoft-com:HashTransforms.Identity“></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=“″></dsig:DigestMethod><dsig:DigestValue>ojDmTgpYMFRKJYkPcM6ckpYkWUU=</dsig:DigestValue></asmv2:hash></file> <file name=“msvcm90.dll“ hashalg=“SHA1″ hash=“5470081b336abd7b82c6387567a661a729483b04″><asmv2:hash xmlns:asmv2=“urn:schemas-microsoft-com:asm.v2″ xmlns:dsig=““><dsig:Transforms><dsig:Transform Algorithm=“urn:schemas-microsoft-com:HashTransforms.Identity“></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=“″></dsig:DigestMethod><dsig:DigestValue>tVogb8kezDre2mXShlIqpp8ErIg=</dsig:DigestValue></asmv2:hash></file>


and copy the files to your Microsoft.VC90.CRT folder.

Copy the whole Microsoft.VC90.CRT to your DLL folder in the python installation.

Thats all.
Now you can put your installation on a usb-key or deliver it to a costumer without installation.

Install Dabo on Puppy Precise Linux (maybe also work on ubuntu 12.04 LTS)

The advance of puppy linux is, that it is a very small and light weight distribution.
You can install puppy with dabo and xampp (includes Mysql) on a 1 GB usb device  or a virtual machine and take it with you to your customers.

  • Install Precise Puppy 5.7.1 on a usb device or an virtual machine (or where you want)
  • Update the Puppy Packet Manager
  • Click on xampp1.8.1.sfs in your file-manager and follow the instructions.
  • Open the Puppy Packet Manager and search for idle2.7_2.7.3 package and install.
    This is the python environment with the idle IDE
  • Install wxpython. This part is a little tricky. You can find a installation manual here
  • Open the Puppy Packet Manager and search for python_mysqldb_1.2.3.
    This is the package that will give you access to the mysql-database of the xampp-package.
  • Open the Puppy Packet Manager and search for python_setuptools_0.6.24.
    This package is needed to install Dabo.
  • Dowload Dabo.
    The best way is to check out via svn. You can also download the tarball from here
  • .Unpack the downloaded tarball or the files you checked out in:
    Now you will have a daboXXXX folder in /usr/lib/python2.7/dist-packages/ (xxxx is the version)
  • Open a terminal in this folder and type: python install
    Now Dabo will be installed in your python environment.
  • Change to the folder demo in your current directory and start the demo application with: python

If you are doing right, it should work.



How to create modal windows with python 2.7 and TK

form1 is the main window.modform is the „child“ window.

from Tkinter import *
class form1:
def __init__ (self):
self.root = Tk()
self.ev1 = StringVar()
e1 = Entry(self.root,textvariable=self.ev1)
b1 = Button(self.root,text=“click“,command=lambda: self.b1_click()).pack()
def b1_click(self):
mod = modform(self.root)

class modform:
def __init__(self,mroot):
self.mod = Toplevel()
self.ev1 = StringVar()
e1 = Entry(self.mod,textvariable = self.ev1)
b1 = Button(self.mod,text=“click“,command=lambda: self.b1_click()).pack()
def b1_click(self):

f1 = form1()