Re: Python declarative
El miércoles, 15 de enero de 2014 18:02:08 UTC+1, Sergio Tortosa Benedito
escribió:
> 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
Wow thank you very much, really. I wasn't expecting that much from everyone.
BTW, sorry for no answering earlier , I'm receiving no e-mails from the list
(I'll look later what happens). First, I don't like that all parenthesis, I
like to differentiate which type of delimiter is, this is not so bad if using
spaces but anyways it's a little more difficult.Second, In regard, to using
something like myWindow=Window rather than Window "myWindow", at first I didn't
liked it that much, but in the end it does tell the user that the attributes
can be accesed just like anything else. Finally , the project I'm developing
(guilang) it's toolkit-independent so I don't mind having to do some wrappers.
Sergio
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python declarative
El miércoles, 15 de enero de 2014 18:02:08 UTC+1, Sergio Tortosa Benedito
escribió:
> 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
OK, thanks, maybe the to be read by python may be interesting .Anyway, I think
I'll have to consider all the options I have right now (Lua,Python,A file
readed by Python). Really, thanks, you are awesome.
Sergio.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python declarative
El miércoles, 15 de enero de 2014 18:02:08 UTC+1, Sergio Tortosa Benedito
escribió:
> 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
Hi again, just wrote to announce that I'm going to rewrite guilang in Python.
Again thanks you are all awesome :).
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python declarative
Hi again , I'm sorry I dind't reply earlier I still hav enot added myself to the list (I'm doing this trhough google groups). Thanks Asaf, but I don't like having the code and the GUI separated. First,I'm not aiming to not programmers (or people qho don't want to be one) because they may be able to write the layout but not the actual program's function so there's no reason to do that. Second, I wouldn't like to have code and GUI separated since it's a hassle when try to change something like the name. XML and JSON are pretty cool but they serve for loading info which can vary to a fixed engine not for when that info does not change, and that's even more true when you are speaking about an interpreted language. I've been reasearching a bit myself and this is what I got: a way of having a nice syntax in python itself (no external files, no new language...) with metaclasses, so the same example which was used in Lua (and I think in original's python syntax) would look like this with metaclasses and classes: class myWindow(Window): title="Hello World" class myButton(Button): label="Hello World" It's just like what I was looking for, with the added benefit that functions can be defined right there. It has it's own problems (like having to access variables from the global scope), but I think they are either solvable or minor. Sergio -- https://mail.python.org/mailman/listinfo/python-list
