GTK or Tcl/Tk

Started by Sunburned Surveyor, January 14, 2005, 07:44:37 AM

Previous topic - Next topic

Sunburned Surveyor

I think I've narrowed my choices for GUI development with newLisp to 1 of 2 choices:



1. Tcl/Tk

2. GTK



I can't seem to see a clear advantage of one over the other, although I've got a good book on Tcl/Tk at my local library. What have you experienced newLisp developers found to be the best? What are the advantages of the one over the other? I would really appreciate some input. I'd hate to invest significant time learning one option, to find I should've chosen the other.



Thanks,



The Sunburned Surveyor

pjot

#1
Well, me as programmer of the GTK-server, I think you should use GTK. ;-)



But it depends on what you want to achieve. Maybe you can give us more insight into your plans?

Sunburned Surveyor

#2
pjot,



Thanks for declaring your bias! :]



I plan on organizing the development of some serious extensions to AutoCAD/IntelliCAD for the Land Surveying, GIS, and Cartographic communities. Because I would like all of my extensions to be compatible with IntelliCAD, all internal code must be implemented in AutoLISP, not Visual LISP or the other API's exposed by AutoDesk's AutoCAD solely.



However, there are 2 situations that will require programs to run independently of AutoLISP/AutoCAD. (1) These extensions will be accessing data stored externally, in a text file database. I would like the user to have access and the ability to manage this database from an external program. (2) Functionality that can't be implemented internally using AutoLISP will be implemented in external programs, and accessed from within the CAD program via AutoLISP routines.



I had originally planned on writing these external programs in Java, the main programming language I work with. It has some open source libraries available. However, the majority of my volunteer team is unfamiliar with Java, which can be a lot to learn. I thought I would search for something similar to AutoLISP, that would be easier for them to pick up. That's when I stumbled upon newLisp. I need a GUI package that works with newLISP and meets the following requirements.



(1) Easy to learn.

(2) Open Source

(3) Well document for begginers with some AutoLISP background.



If I choose Tcl/Tk that some additional scripting syntax will need to be learned, in order to access the TK GUI stuff. That adds a layer of complexity. Is the same necessary with GTK? I couldn't tell.



I appreciate any advice you can offer.



(At this point, most of the development will be taking place on Windows platforms, if that makes a difference.)



Thanks for any advice.



The Sunburned Surveyor

pjot

#3
Hi Sunburned Surveyor,



Well, if I understand it all well, ultimately you would like to develop some stand-alone applications with a Lisp-like language, but at the same time GUI programming must be possible.



First let's look at your requirements:



(1) Easy to learn.

---> Except for the concept of 'boxes', which has to do with the layout and ordering of the widgets, I found the GTK-API quite easy to learn. Reading through the GTK-tutorials at http://www.gtk.org">http://www.gtk.org, it took me less than a week to master it's API and it's principles. One newLisp developer could even hack a GTK program together in 1 day (the "different time" program at gtk-server.org).



(2) Open Source.

---> GTK is Open Source.



(3) Well document for begginers with some AutoLISP background.

---> Hard to say, but from my own experience I would say that the GTK documentation is rather good. Some stuff I had to lookup elsewhere using Google.



GTK basically is a C API, so there is no need to learn an extra scripting language to realize GUI programming. You do need to learn the GTK functions themselves, though. The idea with the GTK-server is that these functions are sent from the interpreted newLisp program straight to the libraries (DLL's).



But GTK originally is a UNIX toolkit. The Windows port is getting very usable, but is not as stable as the Unix version (yet). I guess for stability TK is a better option on the Windows platform.



If you want to know how a standalone distribution looks like, I mean, a newLisp program packed with the GTK-server and all necessary GTK DLL's, you could take a look at the sample UDP-Chat distribution at http://www.gtk-server.org">www.gtk-server.org. It contains a newLisp UDP chat program converted to an .EXE. Just unzip and run the "chat.vbs" to start.



So, I cannot really give you an advice like "do this" or "do that", but I hope these remarks spread some light on your thoughts.



Peter

Sunburned Surveyor

#4
Thanks for the information Peter.



I can probably work around the issue with Windows stability, and we might also be doing some stuff on Linux.



I think I can get a handle on the GTK API. I've seen the tutorials you mentioned, and they seem well put together.



I've been to Tor's page on GTK programming on Windows:



http://www.gimp.org/~tml/gimp/win32/">http://www.gimp.org/~tml/gimp/win32/



I found all the links there a little overwhelming.



Is there a website or document that explains the basicpackages I need to download and intall for Windows to get started with GTK and GTK Server?



I think I can get the basics of working with GTK-Server through newLISP from your GTK-Server website. I think the initial hurdle for me will be getting a Windows machine set up for GTK development. Once I get through one set-up I can explain it to the rest of my team.



Thanks again for your assistance.



The Sunburned Surveyor

pjot

#5
Well, the website of Tor contains all the software (sources, headers, extra packages) to recompile GTK for Windows yourself. I need that stuff as well to get the GTK-server compiled.



However, from a newLisp point of view, you do not need any of Tor's packages. At the GTK-server website, in the download section you will find this line:



  • o Recommended GTK 2.x version: download (1.3 build 2) and the GTK 2.x environment: GTK 2.4.14



That's all. Just download the GTK-server itself, and the installpackage for GTK 2 (unless you insist on using GTK1). More you do not need. With this you are ready to start developing with GTK2 and newLisp. Maybe you can download some of the demo-programs at the GTK-server website as well, to get a feeling for it all.



Peter

HPW

#6
For the Tcl option you should consider Tcl Dev Kit from http://www.activestate.com/Products/Tcl_Dev_Kit/">http://www.activestate.com/Products/Tcl_Dev_Kit/ which would you allow to build a distributable app. Similar to freewrap which is used for the newlisp-tk frontend.



Of cource no open source.

Also there remains the option to embed newlisp.dll in other GUI-enviroments (delphi,powerbasic,neobook,VB etc.)
Hans-Peter

Sunburned Surveyor

#7
Peter,



That's great news! Thank you for your hard work. I'm sure the newLisp community appreciates it. I'll download the file you indicated, and take a closer look at those examples. I'm glad you posted a response to my question. It sounds like the solution I'm looking for.



The Sunburned Surveyor

Sunburned Surveyor

#8
I took a look at the GTK tutorials. Is a good knowledge of C or C++ needed to use GTK/GTK Server, or do i just need to know the API calls?



The Sunburned Surveyor

pjot

#9
Hi Sunburned Surveyor,



Just the API calls. Do not forget to install the GTK-environment as well. So, in total you need to install 2 packages (GTK-server and the GTK-environment 2.4.14).



To distribute your newLisp program as a stand-alone package, please take a look at the example http://www.gtk-server.org/UDP-Chat.zip">http://www.gtk-server.org/UDP-Chat.zip . This ZIP file is a self-containing archive with everything needed (including a newLisp app) to run a GTK-server program. In this way you do not need to bother your users with the different install-procedures. (Instead of a ZIP-file this could have been a complete installpackage as well, of course.)



In case you have GTK-server related questions, you may better subscribe yourself to the GTK-server mailinglist, since this is the place to discuss newLisp.



Regards and good luck,



Peter

nigelbrown

#10
It would speed uptake of GTK-Server if some higher level newLisp functions that set up a few common form designs and handled some common button functions could be put together.



I would find a function that took a list of lists and displayed a new window with it in a scrollable selectable grid with buttons for EditItem, AddItem, RemoveItem, Done where Done has the function of "close the window and return the modified list of lists"  a most useful thingy.  Really just an interactive list editor.



Does anyone have a function like that lurking in their code?



Nigel

pjot

#11
Hi Nigel,



Agreed. I've been thinking about that myself as well, writing a complete newLisp module with predefined GUI functions which can be accessed from any newLisp program. These predefined GUI functions should enable the user to setup a GUI in a fast and efficient way.



<sigh>



But it's just too much work, I do not have such a module. If anybody comes up with such a thing I would be very interested as well.



Peter

nigelbrown

#12
Rather than feeling we have to do a whole module how about just one function at a time?



A single pop-up list editor would be a handy start.

Nigel

pjot

#13
In that case you might consider using Xdialog as well:



http://xdialog.dyns.net/">http://xdialog.dyns.net/



They have a thing called a "buildlist box". I guess this is getting close to what you want? The downside however is that it'll only work with Unix.



Maybe some compatibility module can be created for the GTK-server with the same dialogs as Xdialog.



Peter

nigelbrown

#14
I'll fiddle with some functions and post any that work.



Nigel