For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > November 2005 > is Tk the best ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author is Tk the best ?
Krystian

2005-11-12, 7:56 am

Hi all
I know that this question is perverse and maybe i shouldn't ask it
here but i hope people from this group have most experience in
building GUI applications.there are other choices for building GUI
programs, eg. wxperl. what could you say about competition? about rest
of possibilities? is something else worth of using? maybe in different
adaptation? how good is Tk with comparision to others?

best regards
k
Rob Seegel

2005-11-12, 6:58 pm

Krystian wrote:
> what could you say about competition? about rest
> of possibilities? is something else worth of using? maybe in different
> adaptation? how good is Tk with comparision to others?


There are other toolkits and I use several of them. However a question
like this is so open-ended and subjective that I wonder if any answer is
likely to prove helpful. It would be better for you to refine your
question a bit. What criteria are important to you in selecting a
toolkit? Are there key features that you desire?

I suspect that there are some things that are important, otherwise *any*
toolkit could potentially meet your needs. Personally, there are things
about Perl/Tk that I don't like, and other things that I do. My choice
will depend on the task, the environment I'm deploying to, follow-on
maintenance of the application, and other technical and non-technical
considerations.

I can't speak for anyone else, but I'd be willing to bet that you will
get a better response, once you refine your question. Also you might
consider searching the newsgroup archives with google groups, or the
perlmonks.org website.

Rob


Dean Arnold

2005-11-12, 9:56 pm

Rob Seegel wrote:
> Krystian wrote:
>
>


A reluctant reply, but what the heck...

This question tends to surface here on a nearly annual basis.
(A google groups search would likely surface something, my fav is

http://groups.google.com/group/comp...08bba130fe0a95b

sorry for the long URL)

Anyway...

I've built a rather large scale IDE w/ pTk. I ran into problems.
I looked into wxPerl. No docs, so I gave up. I looked into Eclipse.
Piles and piles...and piles...and piles...ad nauseum of scanning
Java code later - just to try and figure out how to put a breakpt icon in
the IVerticalRuler - I decided to take a pass. There are numerous
other options, but most are platform specific (Win32::GUI, etc.).

Recently, there's been repeated mention here RE: Tcl::Tk. Looks
very promising...until you discover the Tcl/Tk widget set is scattered
from hell to breakfast all over the 'net. Unlike pTk, where most widgets
are available by s quick search of CPAN (yes, I know there are exceptions
and deficiencies).

So I came back to pTk, despite its perceived deficiencies.
Some things I wish for (its nearly Christmas, afterall...):

- I wish pTk stayed a bit more up to date with its
Tcl/Tk sibling.
- I wish it was more thread friendly (a situation I hope
to address in the near future).
- it doesn't have all the sexy chrome modern GUI kits have

But, if you need

- to just get something done PDQ
- a GUI that's platform portable
- some usable docs to guide you (hardcopy or online),
- "one-stop shopping" for your widgets
- to keep it simple, and mostly declarative

pTk does a very admirable job.

I just recv'd my copy of "Foundations of AJAX" (Asleson & Schutta, apress).
Maybe that will convince me to switch to something browser based. But
I doubt it.

Dean Arnold
Presicient Corp.
zentara

2005-11-13, 7:56 am

On Sat, 12 Nov 2005 12:44:25 +0100, Krystian <nobody@this.home.com>
wrote:

>Hi all
>I know that this question is perverse and maybe i shouldn't ask it
>here but i hope people from this group have most experience in
>building GUI applications.there are other choices for building GUI
>programs, eg. wxperl. what could you say about competition? about rest
>of possibilities? is something else worth of using? maybe in different
>adaptation? how good is Tk with comparision to others?
>
>best regards
>k


I got to throw my 2 cents in :-).

Tk is the easiest, has the best documentation, and is the best for
finding answers online. So yes, it is the best. ActiveState makes
it easy to install on Windows, so it is easy for cross-platform work.

Tk is not the best from a technical viewpoint. Gtk2 is better, BUT
it will take you alot longer to learn and figure out all the minute
details involved with Gtk2. Why is Gtk2 better? Because it is built
on the well thought out and integrated Gtk2 c-libraries. So the
underlying logic is very clean and predictable (if you can figure it
out).
Tk, on the other hand, often has some weird inconsistencies, that you
just have learn to live with. This is because Tk developed as a
haphazard set of widgets based on TCL.

Wx is just a wrapper library, which uses Gtk2 underneath. Wx gives you
a C++ style object oriented approach to the Gtk2 c libs. The recent
WxPerl builds and works very well on linux. (I did have to manually
install a few files to get it to build, but it is pretty nice if you
like that C++ style).

Qt's Perl port is just sitting in the dust, due to licencing issues or
lack of interest.

So I would say, to use Tk, but try to start learning Gtk2. The basic
principles you learn from Tk, will make it easier to pick up Gtk2.

Most of the time, you just want to slap together a simple GUI to be
a front end for something. Tk works beautifully for that purpose, and
if you run into trouble, people here will usually have an answer for
you.
If you run into roadblocks with Wx or Gtk2, you will be hard pressed
to find answers, although Perl/Gtk2 has a good maillist which will
help with most problems.






--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Krystian

2005-11-13, 6:58 pm

Hi

>There are other toolkits and I use several of them. However a question
>like this is so open-ended and subjective that I wonder if any answer is
>likely to prove helpful. It would be better for you to refine your
>question a bit. What criteria are important to you in selecting a
>toolkit? Are there key features that you desire?


i don't need any particular module right now but i have to build GUI
for some app sometimes. you are right this subject is open-ended but
as you said you use several toolkits and criteria is very important.
so could you share with your observations and experience? what and
when do you use? :)

>I suspect that there are some things that are important, otherwise *any*
>toolkit could potentially meet your needs. Personally, there are things
>about Perl/Tk that I don't like, and other things that I do. My choice
>will depend on the task, the environment I'm deploying to, follow-on
>maintenance of the application, and other technical and non-technical
>considerations.


it would be really great if you could amplify this tought and describe
what are your choices when you have particular needs.

maybe it would be also a good idea to compare Tk with other toolkits
from other languages (eg. Swing in Java). I found that with pTk it is
possible to build GUI very fast, even when knowledge about this module
is at basic level.

thanks for answer
krystian
Ben Crowell

2005-11-13, 6:58 pm

Rob Seegel wrote:

> I can't speak for anyone else, but I'd be willing to bet that you will
> get a better response, once you refine your question. Also you might
> consider searching the newsgroup archives with google groups, or the
> perlmonks.org website.

I recently posted on perlmonks.org on exactly this topic. Some people
think Prima looks interesting. Others recommended wxperl, perl-gtk2,
or perl/tk. For me, the availability of O'Reilly books for perl/tk
was a big plus. I've had some frustrations with perl/tk's stability,
but actually the other options people suggested on perlmonks are
probably all *worse* in terms of stability (just a guess, but they're
all newer, and undergoing more rapid development). The GTK2 C libraries
themselves are all undergoing rapid development, and are changing their
APIs frequently, so if stability is a big concern, it's probably best
to stay away from anything based on GTK2. Prima looks like a sweet,
clean design, but I'm not sure how widely it's used, and how well
supported it's likely to be on an indefinite basis; I was also
a little scared that it used its own idiosyncratic perl-to-C interface
rather than XS.
Robert Hicks

2005-11-14, 9:56 pm

I would say that while they are scattered across the net...a simple
search of the Tcl wiki will get you were you want to go pretty fast:

http://wiki.tcl.tk/

Dean Arnold

2005-11-15, 3:59 am

Robert Hicks wrote:
> I would say that while they are scattered across the net...a simple
> search of the Tcl wiki will get you were you want to go pretty fast:
>
> http://wiki.tcl.tk/
>


Tried that about a year ago..many of the sites were gravesites,
and in fact the Tk site itself was pretty comatose at the time as well.
Which didn't exactly inspire confidence. (I recently encountered
a similar situation with Gtk+...links to "screenshots" that
spit out "Not found" alerts...I hope those weren't the screenshots 8^/)

I spose if I had nothing better to do with a day and a half but
crawl the web looking for a particular widget...and then hope there's
some semblence of docs for using it...and it works as advertised...
its probably OK. After all, I pissed away that much time trying to
figure out how to build a cascading menu in wxPerl about 18 months ago,
which led me to the same general conclusion, i.e., back to pTk.
(fortunately, a recent perl.com article describes how to do that in wxPerl...
which may, in fact, be more documentation than can be found for the entire
remainder of wxPerl).

However, since I usually don't have that much free time, I'll stick to
search.cpan.org. If I can't find what I need, its often easier/quicker to
build a pTk widget than to scrounge for a usable, documented Tcl::Tk equivalent.

Don't get me wrong, I'm not bashing alternatives cuz I'm happy about
the situation; quite to the contrary, I'm very frustrated by it. On more
than one occasion, I've pondered cashing Perl, and jumping back to Java
because of this. But pTk is just too easy to use, so I'm toughing it out.

In the spirit of constructive criticism, Here's a couple little
clues to Perl GUI tookit builders/contributors:

1) Documentation matters. Just saying, "Use the C library docs" is a great
way to drive folks like me away, esp. after I discover - after many hours
of labor and frustration - that the Perl implemenation *doesn't* match
the C/C++ API (yes, I'm looking at you, wxPerl).

2) Scattering the widget set all over the web (including in a few
cemetaries) is also a great way to engender indifference.
I also get frustrated when I occasionally find pTk widgets that
somehow end up in SourceForge, but not in CPAN. I write Perl. When I'm searching
for a widget, I look in CPAN, *not* SourceForge. I realize SourceForge
provides lots of nice features CPAN doesn't. But there's no law against
mirroring in CPAN. If you want your widget to be used, you need to put it
where Perl programmers are going to look. And thats CPAN.

Hmmm, I didn't intend for this to become a rant...guess this
subject is more of a burr in my dle than I realized.

Dean Arnold
Presicient Corp.
Krystian

2005-11-15, 7:00 pm

Hi

>Hmmm, I didn't intend for this to become a rant...guess this
>subject is more of a burr in my dle than I realized.


;) I think it is a good idea to talk about it sometimes. Probably this
subject is open-ended but new modules appear each year. Tracing it is
not what everybody do, so lets share with knowledge about new
discoveries. Maybe it is also a good idea to talk about other
languages and theirs GUI toolkits, just to compare and so on.

best regards
krystian
Robert Hicks

2005-11-15, 7:00 pm

I wasn't bashing CPAN either. There are two things that keep me in the
Perl camp. #1 is CPAN and #2 is the DBI/DBD.

I have only been looking at Tcl/Tk for about 6 months and I have never
had any problems finding the extensions I needed but everyone has their
own experiences. I have also been harping on them to get a TPAN going
to address the need to "centralize" packages. Tk is actually getting a
facelift as well. I wish that Perl (like Python) would move to a
Tcl::Tk interface. Python gets any updates to Tk much faster than us
Perlers.

I use Perl/Tk for a lot of quick utilities at work. I am just now
starting to look into wxPerl but I am not a C/C++ programmer and
looking that the wx docs gives me the willies. I am actully looking
forward to the wxPython book because that will be much easy to look at
and adapt than the current wxPerl docs.

Robert Hicks

2005-11-15, 7:00 pm

Well...ok...there are more than just those 2 things that keep me using
Perl. : )

Jeff Hobbs

2005-11-18, 3:57 am

Dean Arnold wrote:
> Robert Hicks wrote:
>
> Tried that about a year ago..many of the sites were gravesites,
> and in fact the Tk site itself was pretty comatose at the time as well.


What about the Tk site was "comatose"? Which site in particular?
http://www.tcl.tk/ is considered the "primary" Tcl/Tk site, and
in part (for better or worse) the primary Tk site as well. It
could use some improvement to enhance the Tk awareness with the
latest and greatest snapshots, but the content is accurate.

As for finding widget sets, yes, the scatter issue is a bit of a
problem that is being addressed. One main advantage to Tcl::Tk
though is that you can use any existing Tcl/Tk widget, which
means you have all of the combined, easy-to-find, fully doc
loaded ActiveTcl to play with.

> However, since I usually don't have that much free time, I'll stick to
> search.cpan.org. If I can't find what I need, its often easier/quicker to
> build a pTk widget than to scrounge for a usable, documented Tcl::Tk
> equivalent.


Actually ... you should be able to slot in Tk widget sets into
CPAN with just a bit of Makefile.PL shoe-horning that would rely
on Tcl::Tk and leverage CPAN for Tk widgets, even Tcl-based ones.

--
Jeff Hobbs, The Tk Guy
http://www.ActiveState.com/, a division of Sophos
Jeff Hobbs

2005-11-18, 3:57 am

zentara wrote:
> On Sat, 12 Nov 2005 12:44:25 +0100, Krystian <nobody@this.home.com>
>
> I got to throw my 2 cents in :-).

...
> Tk is not the best from a technical viewpoint. Gtk2 is better, BUT
> it will take you alot longer to learn and figure out all the minute
> details involved with Gtk2. Why is Gtk2 better? Because it is built
> on the well thought out and integrated Gtk2 c-libraries. So the
> underlying logic is very clean and predictable (if you can figure it
> out).
> Tk, on the other hand, often has some weird inconsistencies, that you
> just have learn to live with. This is because Tk developed as a
> haphazard set of widgets based on TCL.


With the full foreword that I am a core Tk developer, I will
toss my 3 cents back (it's Canadian, eh?). I believe that Tk
actually has the better technical framework. Yes, I have gone
digging into the gtk2 sources (not for long, as my sanity was
threatened ...). Just do some source diving to compare. Tk
abounds with pertinent source code commenting and other bits
that make understanding it at the C level much easier.
Consider also the Tk is actually mature over a much widget
range of platforms than Gtk2 (go from OS X to Windows/CE to
64-bit AIX powerpc ...).

On the other hand, Gtk2 does have a large core base of items,
and that is to its advantage. Not all the extensions to Tk
provide the same level of code cleanliness, and there are not
all organized in something like CPAN. These are things that
are being addressed.

--
Jeff Hobbs, The Tk Guy
http://www.ActiveState.com/, a division of Sophos
Rob Seegel

2005-11-18, 3:57 am

Jeff Hobbs wrote:
> Dean Arnold wrote:
>
> Actually ... you should be able to slot in Tk widget sets into
> CPAN with just a bit of Makefile.PL shoe-horning that would rely
> on Tcl::Tk and leverage CPAN for Tk widgets, even Tcl-based ones.
>


Jeff,

The last time I checked, there were issues with how event handling was
done in Tcl::Tk. Ok, not so much as issues, but areas where they didn't
match Perl/Tk. I'd have to check my notes for specifics, but is this
still the case, as far as you know? Lately, I've been considering giving
Tcl::Tk another try, and seeing how difficult it would be to make my
personal widget library work using Tcl::Tk. It didn't go well when I
first tried several months ago.

Rob
zentara

2005-11-18, 7:56 am

On Thu, 17 Nov 2005 20:21:47 -0800, Jeff Hobbs <jeffh@activestate.com>
wrote:

>zentara wrote:
[color=darkred]
>With the full foreword that I am a core Tk developer, I will
>toss my 3 cents back (it's Canadian, eh?). I believe that Tk
>actually has the better technical framework.


>Yes, I have gone
>digging into the gtk2 sources (not for long, as my sanity was
>threatened ...).

No lie there.

>Just do some source diving to compare. Tk
>abounds with pertinent source code commenting and other bits
>that make understanding it at the C level much easier.
>Consider also the Tk is actually mature over a much widget
>range of platforms than Gtk2 (go from OS X to Windows/CE to
>64-bit AIX powerpc ...).
>
>On the other hand, Gtk2 does have a large core base of items,
>and that is to its advantage. Not all the extensions to Tk
>provide the same level of code cleanliness, and there are not
>all organized in something like CPAN. These are things that
>are being addressed.


That is why I still say that Tk is the "best overall", but Gtk2 is
an up-and-coming competitor who looks like a thorobred
race-horse, instead of a giant Belgian workhorse.

Gtk2 has some sexier appeal. Like the ability to set themes,
and it is closer to being thread-safe, due to all objects being
based on the same underlying GOBject ( or whatever they call it).
I think a "thread-safe" rating is a real advantage in writing the big
complex scripts, that people want nowadays.

There is only a handful of people who current understand Perl/Gtk2
in all of it's complexity, so that is the real drawback to it, but that
is changing fast.



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Dean Arnold

2005-11-18, 6:59 pm

zentara wrote:
>
> Gtk2 has some sexier appeal. Like the ability to set themes,
> and it is closer to being thread-safe, due to all objects being
> based on the same underlying GOBject ( or whatever they call it).
> I think a "thread-safe" rating is a real advantage in writing the big
> complex scripts, that people want nowadays.
>


Whats the situation wrt Perl/Gtk2 on Win32 ? I've done some searching,
but can't seem to find a single coherent indicator of its support,
viability, how/what to install/build, etc. Theres a gtk+ page RE: Win32,
but it didn't seem very helpful, or current.

Dean Arnold
Presicient Corp.
Dean Arnold

2005-11-18, 6:59 pm

Jeff Hobbs wrote:
> Dean Arnold wrote:
>
>
>
> What about the Tk site was "comatose"? Which site in particular?
> http://www.tcl.tk/ is considered the "primary" Tcl/Tk site, and
> in part (for better or worse) the primary Tk site as well. It
> could use some improvement to enhance the Tk awareness with the
> latest and greatest snapshots, but the content is accurate.
>


Took me awhile to find (google groups didn't have it for some reason),
but my Send folder surfaced a dialogue on the ptk maillist in which I respond
to one Vadim Konovalov, "RE: Anyone try running Insight/gdbtk thru tcl2perl ?"
with:

"3. Much of the tcl.tk website seems to be undergoing repair...is
there an alternate link to enumerate all available widgets ?"

....which led me a merry chase akin to googlewhacking.

IIRC, I checked again about a month later, and it was still "being repaired",
so I pretty much cashed it.

I'll take your word that the site is now fully revived...tho it still doesn't
appear to have addressed the central repository issue (as you mentioned).

So, at least for the present, I'm still entrenched in the pTk camp,
Tho I wish I had more time to pursue these alternatives; what free time
I do have is being applied to research AJAX solutions, which are looking
more appealing every day...

Dean Arnold
Presicient Corp.
Jeff Hobbs

2005-11-18, 6:59 pm

Rob Seegel wrote:
> Jeff Hobbs wrote:
>
> The last time I checked, there were issues with how event handling was
> done in Tcl::Tk. Ok, not so much as issues, but areas where they didn't
> match Perl/Tk. I'd have to check my notes for specifics, but is this
> still the case, as far as you know? Lately, I've been considering giving


There are no event handling issues that I know of in Tcl::Tk.
In fact, for the Perl Dev Kit we use Tcl's event loop handling
through the bridge with a callback to a Perl sub - works like
a charm, even on Windows.

--
Jeff Hobbs, The Tk Guy
http://www.ActiveState.com/, a division of Sophos
Jeff Hobbs

2005-11-18, 6:59 pm

Dean Arnold wrote:
> Jeff Hobbs wrote:
[color=darkred]
> "3. Much of the tcl.tk website seems to be undergoing repair...is
> there an alternate link to enumerate all available widgets ?"
>
> ...which led me a merry chase akin to googlewhacking.
>
> IIRC, I checked again about a month later, and it was still "being
> repaired",
> so I pretty much cashed it.


Yes, you remembered correctly. What was resource.tcl.tk (an
AOLserver/OpenACS-based site) was decommissioned because it was
such a popular spammer target that they were even creating user
accounts to add spam links. All the content has been moved to
wiki.tcl.tk, which has ~8000 of user-managed content. It uses
other methods for spam-reduction, but it still gets targeted. :/

--
Jeff Hobbs, The Tk Guy
http://www.ActiveState.com/, a division of Sophos
Jeff Hobbs

2005-11-18, 6:59 pm

zentara wrote:
...
> That is why I still say that Tk is the "best overall", but Gtk2 is
> an up-and-coming competitor who looks like a thorobred
> race-horse, instead of a giant Belgian workhorse.
>
> Gtk2 has some sexier appeal. Like the ability to set themes,
> and it is closer to being thread-safe, due to all objects being
> based on the same underlying GOBject ( or whatever they call it).
> I think a "thread-safe" rating is a real advantage in writing the big
> complex scripts, that people want nowadays.


Tk is thread-safe as well, although using it in multiple threads
depends a bit on the OS (in general, UI toolkits are recommended
to be run in one thread with helper threads that feed it).

As for themes, this is all in the Tk 8.5 core, although you can
use it now in 8.4 through the tile extension (which was the
blueprint for the 8.5 stuff). This is used in the Perl Dev Kit
through Tcl::Tk. Here is an XP screenshot:

http://aspn.activestate.com/ASPN/do...erlApp_gui.html

and more info on the extension itself (with more screenshots):

http://tktable.sourceforge.net/tile/

--
Jeff Hobbs, The Tk Guy
http://www.ActiveState.com/, a division of Sophos
zentara

2005-11-19, 7:56 am

On Fri, 18 Nov 2005 08:41:58 -0800, Jeff Hobbs <jeffh@activestate.com>
wrote:

>zentara wrote:


>
>Tk is thread-safe as well, although using it in multiple threads
>depends a bit on the OS (in general, UI toolkits are recommended
>to be run in one thread with helper threads that feed it).


Well the latest Gtk2 libraries allow you to pass an object (widget)
to a thread on creation, and have the thread directly manipulate
the object.
It also allows you to create threads, after the gui code has been
established.
It has a few new methods
Gtk2::Gdk::Threads->enter;
Gtk2::Gdk::Threads->leave;

which allows the mainloop to dip into a thread and be manipulated.
From what I gather, it is some sort of thread-locking, as only 1 thread
at a time can be entered.

That is taking a giant step forward pass the point of what Tk can do
with threads.

I eagerly await the next Tk release to see how the themes work.




--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com