Here is what I use in easygui: <pre> #-------------------------------------------------- # check python version and take appropriate action #-------------------------------------------------- """ >From the python documentation:
sys.hexversion contains the version number encoded as a single integer. This is guaranteed to increase with each version, including proper support for non- production releases. For example, to test that the Python interpreter is at least version 1.5.2, use: if sys.hexversion >= 0x010502F0: # use some advanced feature ... else: # use an alternative implementation or warn the user ... """ if sys.hexversion >= 0x020600F0: runningPython26 = True else: runningPython26 = False if sys.hexversion >= 0x030000F0: runningPython3 = True else: runningPython3 = False if runningPython3: from tkinter import * import tkinter.filedialog as tk_FileDialog from io import StringIO else: from Tkinter import * import tkFileDialog as tk_FileDialog from StringIO import StringIO </pre> -- Steve Ferg -- http://mail.python.org/mailman/listinfo/python-list