Easy-to-use Python GUI

Tim Roberts timr at probo.com
Wed Dec 31 08:18:20 CET 2008

"Joel Koltner" <zapwireDASHgroups at yahoo.com> wrote:
>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.

Well, allow me to point out that the equivalent code in wxPython would not
be very much longer than this.  It's just spelled differently.  Sure, you
have a bit of a learning curve to climb, just like you do with any new
development tool.  Once you take the time to get familiar with it, you'd
read the wxPython program just as easily as that Basic example.
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list