Table Driven GUI Definition?

Philip Semanchuk philip at
Sat Aug 6 00:51:36 CEST 2011

On Aug 5, 2011, at 6:20 PM, Tim Daneliuk wrote:

> On 8/5/2011 3:42 PM, Philip Semanchuk wrote:
>> On Aug 5, 2011, at 4:10 PM, Tim Daneliuk wrote:
>>> On 8/5/2011 2:05 PM, Irmen de Jong said this:
>>>> On 05-08-11 19:53, Tim Daneliuk wrote:
>>>>> I have a task where I want to create pretty simple one page visual
>>>>> interfaces (Graphical or Text, but it needs to run across Windows,
>>>>> Cygwin, Linux,*BSD, OSX ...).  These interfaces are nothing more
>>>>> than option checklists and text fields.  Conceptually something like:
>>>>>                 Please Select Your Installation Options:
>>>>>            Windows Compatibility Services  _
>>>>>            Linux Compatibility Services    _
>>>>>            TRS-DOS Compatibility Services  _
>>>>>            What Is Your email Address:     _______________________
>>>>> What I'm looking for is a way to describe such forms in a text
>>>>> file that can then be fed into a tool to generate the necessary
>>>>> pyGUI, Tkinter, (or whatever) code.   The idea is that it should
>>>>> be simple to generate a basic interface like this and have it
>>>>> only record the user's input.  Thereafter, the python code
>>>>> would act on the basis of those selection without any further
>>>>> connection to the GUI.
>>>>> An added bonus would be a similar kind of thing for generating
>>>>> web interfaces to do this.  This might actually be a better model
>>>>> because then I only have to worry about a single presentation
>>>>> environment.
>>>>> Ideas anyone?
>> Hi Tim
>> This looks pretty straightforward to me; maybe I'm missing something. It doesn't look trivial, but the steps seem pretty clear. Is there some part in particular that's giving you trouble?
>> Cheers
>> Philip
> I want to take a text definition file that looks something this:
>  Title         "Please Select Your Installation Options:"
>  Checkbox      "Windows Compatibility Services"
>  Checkbox      "Linux Compatibility Services"
>  Checkbox      "TRS-DOS Compatibility Services"
>  Inputbox       "What Is Your email Address:"
> And have that aut-generate the GUI interface described above for the
> selected GUI toolkit and/or an equivalent HTML page.
> I know I can write a program to do this, but it seems that someone else
> may have already solved this problem.

Oh, I see. I didn't realize you were looking for a most canned solution. I agree that it's a problem that's been solved many times.

I've used Mako before as an HTML templating engine, but ISTR that it points out that it's agnostic to what it's templating. In other words, it only cares about what's between the Mako escape tags, it doesn't care if the surrounding text is HTML or XML or Python or whatever. 

So you could have a Mako template that consists mostly of Python code that builds a wxPython window (if wxPython is your cup of tea) and then some Mako commands in the middle that reads your text definition file and adds checkboxes, textboxes, etc. as appropriate. It's not a canned solution, but it does allow you to separate the boilerplate stuff from the variants.

Hope this helps

More information about the Python-list mailing list