Python declarative

Asaf Las roegltd at gmail.com
Fri Jan 24 07:04:09 EST 2014


On Wednesday, January 15, 2014 7:02:08 PM UTC+2, Sergio Tortosa Benedito wrote:
> Hi I'm developing a sort of language extension for writing GUI programs
> called guilang, right now it's written in Lua but I'm considreing Python
> instead (because it's more tailored to alone applications). My question
> it's if I can achieve this declarative-thing in python. Here's an
> example:
> Window "myWindow" {
> 	title="Hello world";
> 	Button "myButton" {
> 		label="I'm a button";
> 		onClick=exit
> 	}
> }
> print(myWindow.myButton.label)
> Of course it doesn't need to be 100% equal. Thanks in advance
> Sergio

you can also encode widget event handler 
function names into same text file and module names where 
functions are written so they will be called by string name.
The only thing will be left - creation of those module(s).py
and writing functions there and of course the subject of your 
project interpreter/mapper/creator of encoded text to graphical 
primitives. 
For convenience text encoding can retain properties of 
widget library you will choose. or you can/should
also create derived widgets with some predefined look and feel 
and properties to make encoding simpler and typing faster.




More information about the Python-list mailing list