Buenos dias, amigos! I have to write _simple_ gui library, for embedding into game. My first attempt was to use XML: isn't it cute to describe ui in such a way:
<window> <title>Hello World!</title> <image text="nice picture here" pos=... src=... /> <text opts=...> (some text here) </text> <list> <item>first element</item> <item>second one...</item> </list> <button action=... text="Click Me!" /> </window> (or something similar) But after reading "Python Is Not Java" http://dirtsimple.org/2004/12/python-is-not-java.html (BTW I'm not a Java programmer) I realised that it is actually not cute at all :) (am I wrong here?) I am currently seeking for pythonic alternative for XML. One possible way is to create a class for every (type of?) window, like class SomeDlg(Window): def __init__(self, dict?): self.setdict(dict) self.add_text("$friend would like to speak to you. $question") self.add_button(action=self.onclick, text="Yeah, I'd like to $action !") ... def onclick(self): # process data here, send some messages etc. Isn't it ugly a bit? Another variant is dlg = Window(dict, [opts]) dlg.text("text here", [opts]) dlg.image(src, pos, text [etc]) .... or possibly dlg = Window(...) dlg.text = Text(...) dlg.button = Button(...) ... dlg.display(surface) These styles of course can be combined... But IMHO looks not very nice :( Maybe I shall not rely on introspection? Any suggestions, comments, thoughts and links are welcome. Thanks. -- http://mail.python.org/mailman/listinfo/python-list