Select to view content in your preferred language

Python Graphic User Interface

3118
15
02-17-2012 11:49 AM
MikeMacRae
Frequent Contributor
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
KevinGooss
Regular Contributor
I like Wing
0 Kudos
MikeMacRae
Frequent Contributor
Thanks Curtis. Caps on the T. Of course! 🙂

I've pretty much taught myself everything I know about programming, but there's s till a lot I don't know. You said that Tkinter comes with python. I'm assuming you just mean the module and not the gui? The gui is what I'm having troubles with. When I try to interact with it in any way, I get the error above. (i.e. I click on the button for the 'Code Window' and that error pops up and it won't take me to the code window....or when I create a button, and try to go code it, same error....) It's probably something to do with how it's interacting with my PC, I just have no idea what that might be.
0 Kudos
PhilMorefield
Frequent Contributor
Thanks Curtis. Caps on the T. Of course! 🙂

I've pretty much taught myself everything I know about programming, but there's s till a lot I don't know. You said that Tkinter comes with python. I'm assuming you just mean the module and not the gui? The gui is what I'm having troubles with. When I try to interact with it in any way, I get the error above. (i.e. I click on the button for the 'Code Window' and that error pops up and it won't take me to the code window....or when I create a button, and try to go code it, same error....) It's probably something to do with how it's interacting with my PC, I just have no idea what that might be.


I didn't even know that IDE existed. It looks like the project has been stagnant for some time (sort of like the only true Python-based GIS, Thuban).

Even on my 32-bit XP machine it was super buggy. You might have to go old school and do everything command line(!). It's not very hard to pick up and there is a ton of documentation and examples online.
0 Kudos
StacyRendall1
Frequent Contributor
Mike,

The Tkinter module, which is actually used to make GUIs appear on screen that you can interact with, comes with Python be default. You are after a GUI program to help you build/design Tkinter GUIs (I'll call it a GUI builder). For the most part these things let you lay out the GUI, hopefully from there it will look nice, and all you need to do is insert the magic behind the scenes to actually do the calculations when you click the right buttons.

However, in all honesty (and I have really tried to make them work), these kind of GUI builders are just not that great. They tend to hide a bit too much from you, so when you come to inserting the code that does the calculation, it is pretty unclear and difficult. That is if you can actually get the right bits in the right places, layouts, get it to do the right things if the window is expanded/shrunk, etc.

In my opinion, you are best off just to get a good textbook for the GUI module you wish to use and learn it the hard way; fortunately it is usually not that hard (I have done a bit of Tkinter, a reasonable amount of WX, and some Qt), and you will learn a huge amount about Python in the process! Once you actually know how the GUI environment works, then have a go with the GUI builders (i.e. you will know the real difference between a Grid Bag Sizer and a Box Sizer when selecting them from the menu).

Which language to use?
[INDENT]Tkinter is nice in that it comes with Python (no extra installs required), but that is its only positive - it looks like something from Windows 3.1, is definitely the most confusing to learn, and the online documentation is horrific (not sure if it hasn't been updated for the past three versions, or is just plain wrong). WX and Qt are fine - but of the two I would probably recommend Qt - it seems to be a bit newer, more cutting edge, and has some really good, accessible documentation.[/INDENT]

Let us know how you get on!
0 Kudos
ChrisMathers
Deactivated User
This is my go to reference for what little Tkinter I do here.

http://effbot.org/tkinterbook/tkinter-index.htm
0 Kudos
PhilMorefield
Frequent Contributor
Mike-

We'll here you go. A GUI builder for Tkinter: http://tk-happy.sourceforge.net/

I disagree with Stacy that Tkinter is confusing to learn. I actually found it very straightforward, and that's partially due to the fact that your options are pretty limited. It's a very simple module. But if you're just starting out, simpler might be better, as it is for me right now. I've found a ton of documentation online and it's all worked out for me so far.

I agree with Stacy, though, that GUI builders hide too much to give you a complete understanding of what's going on. It really doesn't take much more work to just hard code the layout of the GUI elements yourself. And in the long run, it's certain to make you a better programmer.

And yes, wxPython and PyQt give you a lot more to work with, in terms of both functionality and aesthetics. It's just a matter of what's most appropriate for you.
0 Kudos