<div dir="ltr"><font face="arial,helvetica,sans-serif">Here are a few comparisons. (Note that I always prefer inheriting the main window and thus create a derived widget. This typically requires more code, but in return you get a real widget that integrates seamlessly into the widget system.)<br>
<br>Python gtk:<br><br>#!/usr/bin/python<br><br>import gtk<br><br>class HelloWorld(gtk.Window):<br> def button_clicked(self, data):<br> print "Hello World!"<br> <br> def __init__(self):<br> gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)<br>
<br> self.connect("destroy", gtk.main_quit)<br> <br> button = gtk.Button("Press me")<br> button.connect("clicked", self.button_clicked)<br> button.show()<br>
self.add(button)<br><br>HelloWorld().show()<br>gtk.main()<br><br>Vala:<br><br>using Gtk;<br><br>public class HelloWorld : Gtk.Window {<br> construct {<br> this.title = "Hello World";<br> var button = new Button.with_label("Hello world");<br>
button.clicked.connect( () => {<br> stdout.printf("Hello world!\n");<br> });<br><br> button.show();<br> this.add(button);<br> }<br>}<br><br>int main(string[] args) {<br>
Gtk.init(ref args);<br><br> var hello_world = new HelloWorld();<br> hello_world.show();<br><br> Gtk.main();<br> return 0;<br>}<br><br>For pyside / PyQt see:<br><br><a href="http://www.harshj.com/2009/04/26/the-pyqt-intro/">http://www.harshj.com/2009/04/26/the-pyqt-intro/</a><br>
<br>It carries some additional noise due to the python vs qt bindings.<br><br>Regarding tcl, I once wrote a gtk/Tcl quick and dirty prototyping tool, that may be of interest to someone. See:<br><br><a href="http://gemshell.sourceforge.net/">http://gemshell.sourceforge.net/</a><br>
</font><br>Regards,<br>Dov<br><div class="gmail_quote">On Thu, Jul 19, 2012 at 9:14 PM, Nadav Har'El <span dir="ltr"><<a href="mailto:nyh@math.technion.ac.il" target="_blank">nyh@math.technion.ac.il</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Jul 19, 2012, Dov Grobgeld wrote about "Re: suggestions sought for a framework for a quick, dirty, reallysimple GUI prototype":<br>
<div class="im">> very nicely reflects the beauty of the GObject system. Especially in C it<br>
> is easy to miss that because of the very tedious syntax you need to use,<br>
> e.g. to define an derived class. In Vala the syntax is very concise.<br>
<br>
</div>This is a very important point. This is why I loved Tcl/Tk when I<br>
learned it in the mid 90s - the code to create the gui was so compact,<br>
so elegant - the complete opposite of Xlib, Xaw and Motif, each<br>
requiring you to write dozens of lines for every simple task.<br>
<br>
For example, here is a program in TCL/TK which shows a "hello" button<br>
which outputs "hi" when pressed. How does it look in your favorite<br>
gui language?<br>
<br>
#!/usr/bin/wish<br>
button .a -text "hello" -command "puts hi"<br>
pack .a<br>
<br>
For the curious, the first command creates a button ".a" - in TK, widgets<br>
are hierarchical and have hierarchical pathnames, with "." separating<br>
components, so ".a" is a child of the toplevel window "." with the name<br>
a. The TCL language is a simple language resembling the shell (but with<br>
interesting improvements, which I can eleborate if anyone cares).<br>
The second command "packs" .a in its parent, i.e., the toplevel window<br>
".". "packing" means that you ask to have .a be placed and sized<br>
automatically.<br>
<br>
I'm still saddened by the fate of TCL/TK. I still blame Sun for what<br>
happened to it. sun bought TCL/TK and its inventor John Ousterhout<br>
with intentions of turning TCL into a browser scripting language, and<br>
then "burried" TCL when Sun decided to go with Java instead (though<br>
interestingly, Java NEVER become a language of the web). I'm sad,<br>
because I was really a big fan of TCL and TK. I still am.<br>
<br>
Sic transit gloria mundi.<br>
<div class="im"><br>
> Regarding the fact that it compiles to C, as long as I have an automatic<br>
> build system, what do I care what it compiles to? But most other high<br>
> language bindings to Gtk are just as easy to use (e.g. Python, Lua, or<br>
> Haskell).<br>
<br>
</div>I'm curious, why does it need to compile at all? Why didn't they just<br>
write an interpreter, like TCL did?<br>
<span class="HOEnZb"><font color="#888888"><br>
Nadav.<br>
<br>
<br>
--<br>
Nadav Har'El | Thursday, Jul 19 2012, 1 Av 5772<br>
<a href="mailto:nyh@math.technion.ac.il">nyh@math.technion.ac.il</a> |-----------------------------------------<br>
Phone <a href="tel:%2B972-523-790466" value="+972523790466">+972-523-790466</a>, ICQ 13349191 |error compiling committee.c: too many<br>
<a href="http://nadav.harel.org.il" target="_blank">http://nadav.harel.org.il</a> |arguments to function<br>
</font></span></blockquote></div><br><div style id="divCleekiAttrib"></div></div>