<div dir="ltr"><br><div class="gmail_quote">On Fri, Jul 20, 2012 at 1:21 PM, Dov Grobgeld <span dir="ltr"><<a href="mailto:dov.grobgeld@gmail.com" target="_blank">dov.grobgeld@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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/" target="_blank">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/" target="_blank">http://gemshell.sourceforge.net/</a><br>
</font></div></blockquote><div><br>Way too much code. In Lazarus you do not need to write this code, unless you really want to.<br>Object Pascal is not a dynamic language but a static language, so you can not compare the two.<br>
Even TP was very complex language, and today's language contain even more features, generics, mixin, and a lot more.<br><br>The API of both Lazarus and Delphi is very close to Qt (Qt came after Delphi).<br>But today both with Lazarus and Delphi you can create native code and GUI depends on the platform.<br>
So you do not need to know GTK, Qt, WinAPI, Android API (yes you can compile native code to run in JVM), iOS etc...<br>Except of specific stuff. You just use the API. when you compile to/in windows it will be WinAPI native, no GTK or Qt.<br>
On Linux, you can use GTK or Qt (in compile time you choose it).<br>On Mac it will be native to that, on BeOS it will native to BeOS etc..<br><br>Have a look at my program (not very simple one):<br><a href="https://github.com/ik5/display-quotes">https://github.com/ik5/display-quotes</a><br>
<br>Only one method with some GUI code inside for an open dialog, that i did not want to do in a design time. everything else is about the logic, not about the GUI.<br>If you will check it closely, I even have code that that add extra features if you compile it to GTK, and extra code for Windows based requirements, only one line of code for it.<br>
<br>I binded there the libnotify library arrive from Gnome/GTK. You can see the code itself.<br>When you use Python, you do not use GTK, you use a way that is suitable to Python that at the end translate into GTK.<br>When you use Vala, it again translate into C that is translated into machine code.<br>
When you use Lazarus, you use API, that call the native UI methods (like with Python), but translated into native machine code (elf, exe, class files).<br><br>You have a lot of components and addons in Lazarus, and it is very simple to write code with it that will work everywhere.<br>
But people still think that working hard and dealing with too much dependencies on run time for normal users, is the way to go,<br>and learning 100000 technologies to write one program, is the proper way, or that you do not need a fast executable (the fastest in bench-marking then GCC, intel etc.. ),<br>
then please, by all means, keep on going the wrong way ...<br><br>Just remember that C#, Go and even C11 copied from Object Pascal most of it's features ...<br><br>My last "battle" in this thread on the subject.<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="arial,helvetica,sans-serif">
</font><br>Regards,<br>Dov<br></div></blockquote><div><br>Ido<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div class="im">
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>
</div><div><div class="h5"><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>> 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><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><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" target="_blank">nyh@math.technion.ac.il</a> |-----------------------------------------<br>
Phone <a href="tel:%2B972-523-790466" value="+972523790466" target="_blank">+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></div></div><br><div></div></div>
</blockquote></div><br></div>