Python Graphic User Interface

2082
15
02-17-2012 11:49 AM
MikeMacRae
Occasional Contributor III
Hello everyone,

Over the last year or 2 I've become familiar with python programming within the ArcGIS environment. I'm becoming more comfortable with the language and I've been managing to write some programs outside of Arc to resolve some of my efficiencies and problems. My company mostly works with databases such as access and excel. We also use MS word extensively for report writing. I've dived into a few modules like win32, python-excel, PyWin32, etc and I've taught myself how to parse and write XML's among other things.

I'm starting to branch outside of the Arc environment and I see opportunities within my company to build some programs using python for some of my fellow employees. My question is, I want to find a good GUI outside of Arc that can be used by my co-workers to run some python programs I have built to replace some manual tasks such as data entry and data validation. I seriously don't know anything about python GUI's, so I'm looking for a bit of advice. Which GUI's are you running? Are there some out there that work in conjunction with Arc? Which ones are the easiest to use? Which ones offer the most features? Are they free or do they cost?

Thanks for any input you might have,
Mike
Tags (2)
0 Kudos
15 Replies
Zeke
by
Regular Contributor III
Do you mean you want to design forms, 'windows', etc? There are several GUI packages, the most common being Tkinter, afaik. I haven't done very much with it myself, but there are many tutorials available. There may be better packages out there.
If you're looking for a graphical design interface, like Visual Basic or forms in Access, then I'm not aware of any. Which isn't to say there are none.
0 Kudos
LoganPugh
Occasional Contributor III
Might take a look at PyQt (or Nokia's LGPL version called PySide) and Nokia's Qt Creator: http://qt.nokia.com/products/developer-tools/
0 Kudos
PhilMorefield
Occasional Contributor III
wxPython is also very popular.
0 Kudos
MikeMacRae
Occasional Contributor III
Hey, thanks guys. This is exactly what I was looking for. This is a good starting place to program outside of ESRI.
0 Kudos
curtvprice
MVP Esteemed Contributor
There's a great programmer-oriented tutorial to get started with Tkinter in the Mark Lutz's Programming Python.The biggest advantage of Tkinter is that it's the most popular -- and is part of the standard library in every Python distribution -- no extra installs!

[URL=http://matplotlib.sourceforge.net/]Matplotlib[/URL] is not part of the standard library, but is also very popular, easy way to display data.  Esri is including matplotlib (and numpy, which I think was added for 9.3) in the standard ArcGIS 10.1 installation.
0 Kudos
MikeMacRae
Occasional Contributor III
Hey, I've downloaded tkinter and installed it on my 64 bit, windows 7 computer. I have ArcGIS v10.

I opened tkinter and as soon as I start to play around, I get the following:

[ATTACH=CONFIG]12376[/ATTACH]

it won't let me do much with the interface really. I can open a file, add buttons/text, etc but I can't open the code window.

I've installed it on 2 different computers running the same 64 bit OS. Same result.

Has anyone experienced this?

Thanks,
Mike
0 Kudos
curtvprice
MVP Esteemed Contributor
The error message makes me wonder if you've installed some 64 bit python or tried to install 64 bit Tkinter on top of 32-bit python. (You can only use 32-bit python with ArcGIS.)

If you have installed Python, there is nothing special to download -- the Tkinter module is part of the standard Python library -- all you have to do is import it. (This is one of its main selling points.)
0 Kudos
MikeMacRae
Occasional Contributor III
Thanks Curtis,

I am running the standard python 32 v2.6 that came with ArcGIS. I have changed that since install. I downloaded the latest version of tkinter from sourceforge and when I did the install, it defaulted to my 64 bit program directory. I checked the help file to see it it was a 64 bit or 32 bit version of the tkinter gui, but it didn't say.

Also, I tried to import tkinter as a module in idle and it said no module exists. Does this come with the ArcGIS python install?
0 Kudos
curtvprice
MVP Esteemed Contributor
I tried to import tkinter as a module in idle and it said no module exists. Does this come with the ArcGIS python install?


Yes, it's part of the standard library along with math, string, etc.

http://docs.python.org/release/2.6.7/library/tkinter.html

>>> import Tkinter
>>> help(Tkinter)
Help on module Tkinter:

NAME
    Tkinter - Wrapper functions for Tcl/Tk.

FILE
    d:\python26\arcgis10.0\lib\lib-tk\tkinter.py
0 Kudos