Easy-to-use Python GUI

Joel Koltner zapwireDASHgroups at yahoo.com
Thu Dec 25 00:47:07 CET 2008


Is there an easy-to-use, "function"-based cross-platform GUI toolkit for 
Python out there that's a little more sophisticated than EasyGui?  EasyGui 
looks good, but it's a little more restrictive than what I'd like to have, yet 
I'm (stubbornly :-) ) resistant to stepping up to a "full service" GUI toolkit 
such as pyGTK or wxPython where it's all about event loops and callbacks and 
you need to start planning how the GUI affects the overall program flow rather 
than just using a "forms" (or "Wizard")-type approach where you put up a few 
dialogs, users fill in some variables, and your program just sits around 
waiting until "OK" or "Cancel" is clicked.

One approach that I like comes from SAX BASIC/WinWrap, which is more or less a 
clone of Microsoft's Visual BASIC for Applications, but they (apparently) 
wanted everything to still be human-readable, so they have a simple GUI 
("form") builder that generates code that looks like this:

---

 Begin Dialog UserDialog 850,497,"Export Control" ' %GRID:10,7,1,1

  GroupBox 20,7,360,217,"Drill File Generation",.GroupBox1
  CheckBox 40,35,130,14,"Output drill file(s)",.genDrill
  Text 40,63,270,28,"Identify via layers as any that contain this text in 
their names:",.Text
  TextBox 40,98,220,21,.viaLayerName
  Text 40,140,100,14,"Output method:",.Text8
  DropListBox 160,140,180,21,DrillStyle(),.drillStyle
  Text 40,175,130,28,"Select drill table units:",.Text2
  ListBox 200,175,120,28,unitNames(),.unitName

  OKButton 310,469,90,21
  CancelButton 410,469,90,21

 End Dialog

' GUI builder generates or modifies everything above, but can also be edited 
by hand
' You write the following code...

 Dim dlg As UserDialog

 dlg.genDrill = 1
 ReDim DrillStyle(1)
 DrillStyle(0) = "All Via Layers In One File"
 DrillStyle(1) = "One File Per Via Layer"
 dlg.drillStyle = 1

 func=Dialog(dlg)

---

This is pretty darned easy for me understand and modify either by hand or with 
the GUI builder.  Still, it's quite powerful, since it supports all the common 
GUI elements (text, group boxes, checkboxes, drop-down lists, text boxes, 
buttons, etc.).  This is about the level of sophistication I'm looking for.

Anything like this for Python?

Thanks,
---Joel





More information about the Python-list mailing list