Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > An assessment of Tkinter and IDLE

Reply
Thread Tools

An assessment of Tkinter and IDLE

 
 
Kevin Walzer
Guest
Posts: n/a
 
      08-31-2009
On 8/28/09 8:11 PM, r wrote:
> On Aug 28, 5:48 pm, Mark Roseman<(E-Mail Removed)> wrote:
> (snip)
>> Thewww.tkdocs.comsite is 'language neutral' - currently the tutorial
>> covers Tcl, Perl, Ruby and yes Python, and allows you to switch between
>> any of those languages (or show all of them).

>
> True, however the coverage is incomplete. I would back this site if we
> can get a complete coverage of all widgets in the Python language.
>
> +0.1


Are you certain the site is incomplete? Its coverage of the basic Tk and
Ttk widgets is spectacular. . Its coverage of layout techinques and
best practices for organizing complex interfaces with Tk is also
extremely valuable. I wish this site had been around when I was learning
Tk five years ago. I've looked at just about every Tk and Tkinter
tutorial site out there, and this one surpasses them all. Mark
Roseman--a professional, independent software developer whose commercial
products almost all incorporate Tk into their GUI's--has spent a couple
of years putting together this site with input from various users and
developers (myself included). It's now an absolutely indispensible
resource for beginners and more experienced developers.

The reason the site does not cover 'all widgets in the Python language'
is threefold:

1. It's a site about Tk, a tookit that has Python bindings and bindings
to other languages also (Ruby, Perl, Tcl, etc.).
2. It omits additional Python-specific, Tkinter-based widget sets such
as PMW, Tix, etc. because once you understand the basics of Tk, then
grokking these other megawidget sets (which all build on top of Tk)
should be pretty straightforward.
3. Finally, 'all widgets in the Python language' gets into other tookits
as well, which is obviously unfeasible for a website.

If the site by itself isn't enough for you, or is a bit too basic in its
coverage of Python techniques, then there are other options. Couple the
TkDocs site with effbot's more advanced walk through the various Tkinter
classes, and perhaps one or two of the other Tkinter-specific tutorials,
and you'll have learned a lot. But I think the TkDocs site is essential,
especially in its more advanced discussion of how to put together an
attractive, polished user interface with Tk. Tk has a long-standing
reputation of being the toolkit of choice for quick, simple, ugly
interfaces, and the other resources I've mentioned do nothing to to
change this. The practices that Mark Roseman discusses will allow one to
eventually put together a UI that matches anything that the other big
toolkits (wxPython, PyQt, PyObjC, PyGtk, etc.) can do.

Hope this helps,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
 
Reply With Quote
 
 
 
 
Terry Reedy
Guest
Posts: n/a
 
      08-31-2009
Kevin Walzer wrote:
www.tkdocs.com

[snip]

> and you'll have learned a lot. But I think the TkDocs site is essential,
> especially in its more advanced discussion of how to put together an
> attractive, polished user interface with Tk. Tk has a long-standing
> reputation of being the toolkit of choice for quick, simple, ugly
> interfaces, and the other resources I've mentioned do nothing to to
> change this. The practices that Mark Roseman discusses will allow one to
> eventually put together a UI that matches anything that the other big
> toolkits (wxPython, PyQt, PyObjC, PyGtk, etc.) can do.
>
> Hope this helps,


It persuaded me to go and start reading. A couple of things of interest.

"It would be a great help if you could have a look around, provide any
comments, corrections or suggestions, or even help fill in some of the
missing pieces. "

so no pretense of completeness yet.

"In the near future, the plan is to continue refining the tutorial,
mainly finishing up the rest of the Perl and Python examples."

And from the linked blog

"July 09, 2009
Python material in progress.

While not yet complete, I've managed to add a very hefty chunk of Python
material to the tutorial. I should be able to complete the rest over the
next week or so. Would definitely appreciate feedback from any
Pythonistas on the existing material.

While I hadn't used it before, I think Tkinter may very well be the
nicest interface to Tk next to Tcl's (for which Tk was originally
designed of course, so you'd expect a bit of an advantage). For people
unfamiliar with either language, I think Python's more conventional use
of parentheses for functions, the "option=value" syntax, plus other
language features it takes advantage of are very attractive and win out
over Tcl. The two main parts that I think Tcl does in a nicer way are
event bindings and the fact you can create and geometry manage a widget
in one statement, while still keeping a handle to a widget around.

UPDATE July 17/2009: Most of the rest of the Python examples and code
snippets have been added.
"

tjr

 
Reply With Quote
 
 
 
 
r
Guest
Posts: n/a
 
      08-31-2009
Kevin and Terry,


Kevin.
I respectfully disagree that the site is ready for prime time
*However* i do not wish to undermine the great work that Mark Roseman
has done here and i thank him for his contribution. He has put much
work into covering all the major languages and i think this site
*could* turn out to be the best one-stop-shop for Tk coding no matter
what language you come use. And Actually of all the sites that i know
of, his is by far the most professional/modern looking of all!

My only beef with Mark's site is lack of detailed information OR a
reference manual of sorts in the Python language. We have too many
places around the net one must go to get this information when
starting the road to Tkinter.

The Effbot site is great with much detail but is not a good reference.
John's NMT site is a great reference but lacks the extensive tutorial
style details of effbot. Mark's site is the shiny new corvette,
however the engine is on back order?

We need to compile this info into one beautiful orgy of Tkinter
learning material. Here are the three sites that i mentioned above,
they would compress well into one...

http://effbot.org/tkinterbook/
http://infohost.nmt.edu/tcc/help/pubs/tkinter/
http://www.tkdocs.com/


[TERRY SAID..]
While I hadn't used it before, I think Tkinter may very well be the
nicest interface to Tk next to Tcl's (for which Tk was originally
designed of course, so you'd expect a bit of an advantage). For people
unfamiliar with either language, I think Python's more conventional
use of parentheses for functions, the "option=value" syntax, plus
other
language features it takes advantage of are very attractive and win
out over Tcl.
[/TERRY]

Well put Terry! I could not agree more with this assessment! Pythons
wrapping of Tk is so beautiful next to the other languages i can bet a
lot of Ruby, Tcl, and Perl guys are going to feel like ugly ducklings
at a Ms america pageant! (but i may be partial to Python code... just
a little)

When it comes to using Tkinter I think a lot of people let ego get in
the way. Yes the name may sound synonymous with "Tinker Toys" however,
TEE-KAY-ENTER is a great (albeit simple) GUI toolkit. I use it quite
often and reach for the power of wx only when i need the extra
functionality -- which the gap is starting to close. Anyhow, welcome
to Tkinter Terry, i only wished you would had dropped by
sooner...???

psst: maybe you can use your influence and convince others that Tk is
not so bad?
 
Reply With Quote
 
r
Guest
Posts: n/a
 
      08-31-2009
On Aug 28, 11:12*am, Mark Roseman <(E-Mail Removed)> wrote:
> Would it be useful to link to this from the main Python Tkinter
> documentation?
>
> Mark


Sorry Mark,
i did not realize when i replied to you that YOU are the Mark of
tkdoc.com. For some reason i only saw Tcl code when i visted the site,
and that prompted my slightly grumpy rant. After looking a second time
(and actually reading more) i see this site has much promise. I hope
my post did not seem condescending of your efforts. I think your site
is beautiful and just wish we could add MORE Python specific info to
it like i covered in my last post. And also I would like to see a
complete coverage of all the widgets.

We more experienced guys already know how and where to find the
thousand or so sites for this or that Python info, but the new users
are going to be lost in the wilderness. I love that Python has so much
info out there, i just hate that is so spread out! We must do
something about this in a way that all doc/tut creators can be happy.

PS: and i would like to contribute to your site.
 
Reply With Quote
 
r
Guest
Posts: n/a
 
      10-12-2009

A few things i forgot to mention...

+------------------------------+
Things i forgot... IDLE Editor
+------------------------------+
1. class and path browsers should be available in a tabbed widget
located in the left side of the Editor window. Should also have a show/
hide button or have them contained in a paned window for user reszing.


+--------------------------+
Things i forgot... Tkinter
+--------------------------+
1. Class naming makes no sense...?
Text should be TextBox
Radiobutton should be RadioButton
Checkbutton should be CheckButton
ListBox should be ListBox
(but at least Text should be Textbox!)

2. All text related widgets (Text, Listbox, Entry, Label, CheckButton,
RadioButton, should have a w.sets(setstr) and w.gets(getstr) methods
along with their .insert() method. The settr/getter methods should
take any argument in the form of [str, lst, tuple] and insert the
lines automatically. Why you ask. Well because i hate calling...

>>> w.delete(start, stop)
>>> w.insert(END, str)

#-- or even worse
>>> for x in collection:

w.insert(END, x)
#-- this should be the correct ways
>>> w.sets([1,2,3])
>>> w.sets((1,2,3))
>>> w.sets(line1\nline2\nline3\n) #splits lines for listbox


thats all for now folks!


 
Reply With Quote
 
TerryP
Guest
Posts: n/a
 
      10-12-2009

On Aug 27, 9:22 pm, r <(E-Mail Removed)> wrote:
> ---------------------------------------------
> from Tkinter import *
> ---------------------------------------------
> *Too many noobs start out with the "from Tkinter import *" idiom,
> unknowing that they are horribly polluting their namespace. I feel
> that all (tkinter) code should follow the "import Tkinter as tk"
> policy and never use "from Tkinter import *". To push this agenda i
> propose all docs be modified so that no one should see such global
> import blasphemy again. We should at least keep all example code in
> the latter non-polluting form and frown heavily upon global imports in
> Tkinter code or any code for that matter.
>


'import Tkinter as tk', that I like -- my fingers are lazier then the
mind .


When I see the from whatever import *; I generally regard it in one of
two Things: Good Thing or Bad Thing.


Good Thing:
sometimes program-locale modules are better used
with import *, unless you really should be writing
BazInternals.quxmire everywhere.

Bad Thing:
ahh crap, now I need to know what *is* being
slammed into this namespace.

The programmer should be competent to judge which is appropriate, if
not then they should be *educated* rather then have a hand held, and
told a lullaby. Pass the whisky.

However, I admit that I wish more official documentation dispensed
with the brevity of writing bar() over foo.bar(), it would save me
from having to pay attention to what they are saying in the first
place

On Aug 27, 9:22 pm, r <(E-Mail Removed)> wrote:
> <W1> <-------- W2 ----------->
> >>> | for x in range(10): |

> ... | print x |
> ... | for y in range(x): |
> ... | print y |
> |1
> |2
>


I agree, there should be some reason to use IDLE instead of your
systems command prompt .

On my Pentium D machine, under Windows NT 5.1 (XP), just *moving* the
IDLE shell window around causes taskmgr to report double the CPU
usage, not to mention the choppy feeling it produces. I assume that is
a Tkinter problem. I doubt splitting it the way you describe would
make it any slower.


On Aug 27, 9:22 pm, r <(E-Mail Removed)> wrote:
> Since IDLE has no horizontal scroll bar you must
> use MMB to scroll left-right.


What about having a mouse wheel that tilts left or right? ;}


On Aug 27, 9:22 pm, r <(E-Mail Removed)> wrote:
> *Something that always gets a Python IDLE noob is "open-bracket-syntax-
> errors" in IDLE. When Python throws this type of error normally the
> only clue you will get from IDLE is to see the last line highlighted.
> However, the missing or misplaced bracket is usually no where near the
> end of the script. IDLE can be easily fixed to show a much closer or
> even exact location of the last open bracket.


Considering how often people fuddle up matching marks [], (), {}, '',
"", etc --- why not make Python 'throw' something more helpful
instead? .

For the amount of time that I have used Perl over the years, I learned
two things very important from it. 0.) All language implementations
tend to _s_u_c_k_ at reporting syntax errors; and 1.) if the syntax
error being reported sounds utterly insane, you probably forgot
something; somewhere.


On Aug 27, 9:22 pm, r <(E-Mail Removed)> wrote:
>
> *One of my all time pet peeves with all text editors. Everybody repeat
> after me...
>
> """NO TEXT EDITOR SHOULD EVER COPY AN EMPTY STRING TO THE
> CLIPBOARD!!"""
>
> ...I can't tell you how many times I've had to re-copy some text
> because i accidentally pressed <Control-C> instead of <Control-V>,
> arggh! This bug needs to be fixed yesterday! Pressing <Control-C> with
> no active selection should sound the error bell, not copy "".
>


No, that is probably wrong.


People should use (and create) better software, not create software
that side steps even worse software. "Be liberal in what you accept,
and conservative in what you generate" -- good idea, unless your job
is (almost) strictly GIGO. The clipboard is a garbage buffer, not a
water filter.


If you use Windows a lot, might I suggest a small program called
Qlipboard <http://code.google.com/p/heresylabs/wiki/Qlipboard>.



==== kind off topic ====

The first GUI widget toolkit [sic] that I ever learned, was Qt. It
took me three nights of after work play time to do it: one each to
(re)learn Python, learn Qt/GUI stuff, and practice them both. I did
that using the C++ documentation for Qt and the Python documentation
index for Python. That was with NO experience what so ever in
developing software around graphical user interfaces, unless you count
a love for the `cat f1 f2 f3 | sort | uniq | mail -s "subject"
http://www.velocityreviews.com/forums/(E-Mail Removed)` school of software design.

Tk is probably an excellent toolkit for people to use at first (I've
never used it) but good documentation and an API that's light on brain
damage is the *best* thing to follow up with, next to mind reading .

--
TerryP.
Just Another Programmer
 
Reply With Quote
 
r
Guest
Posts: n/a
 
      10-12-2009
On Oct 12, 12:43*am, TerryP <(E-Mail Removed)> wrote:
> On Aug 27, 9:22 pm, r <(E-Mail Removed)> wrote:
> > *Too many noobs start out with the "from Tkinter import *" idiom,

>
> 'import Tkinter as tk', that I like -- my fingers are lazier then the
> mind .
>
> When I see the from whatever import *; I generally regard it in one of
> two Things: Good Thing or Bad Thing.



Obviously you have never used packages that are meant for global
importing or you would know how such systems are designed. OpenGL is
a good example. OpenGL has over 3600 functions and constants all of
which start with "gl" and GL respectivly. However the Tkinter package
is not a good candidate for this in real use cases. Not only do you
have all the widget classes and functions you have the constants
imported too. ~180 names are imported this way, far too many when not
protected by a naming convention! However learning to use Tkinter for
the beginner is much eaiser when using global imports and i think that
is OK. But very shortly after it is a good idea to get in the habit of
quialifing names with tk.thisorthat().


> I agree, there should be some reason to use IDLE instead of your
> systems command prompt .
>
> On my Pentium D machine, under Windows NT 5.1 (XP), just *moving* the
> IDLE shell window around causes taskmgr to report double the CPU
> usage, not to mention the choppy feeling it produces. I assume that is
> a Tkinter problem. I doubt splitting it the way you describe would
> make it any slower.


Sarcasm anyone? Yes IDLE is not meant for writing million line scripts
but who would want to anyway? And I doubt leaving it in such a
terrible condition will help anyone either. You may find the IDLE and
Tkinter useless but many people find both to be indispensable
(especially noobs). I think this is a case of champagne taste's on a
whiskey budget for you friend!

> > """NO TEXT EDITOR SHOULD EVER COPY AN EMPTY STRING TO THE
> > CLIPBOARD!!"""

>
> No, that is probably wrong.


No it's exactly right and a one-liner to fix. And btw: pass the
reefer because it ain't just whiskey clouding your mind fella! Why do
you reply to a thread about a subject you obviously don't care about?
If you've never used Tkinter or IDLE (and never will) you have no
reason to reply except for the trolling aspect?

good day!
 
Reply With Quote
 
TerryP
Guest
Posts: n/a
 
      10-12-2009
On Oct 12, 7:29 am, r <(E-Mail Removed)> wrote:
> Obviously you have never used packages that are meant for global
> importing or you would know how such systems are designed. OpenGL is
> a good example. OpenGL has over 3600 functions and constants all of
> which start with "gl" and GL respectivly. However the Tkinter package
> is not a good candidate for this in real use cases. Not only do you
> have all the widget classes and functions you have the constants
> imported too. ~180 names are imported this way, far too many when not
> protected by a naming convention! However learning to use Tkinter for
> the beginner is much eaiser when using global imports and i think that
> is OK. But very shortly after it is a good idea to get in the habit of
> quialifing names with tk.thisorthat().
>


I suppose you are right about that one, the largest things I've ever
had to imported tops out around ~600 names; although only used in
interactive mode, not finished product.

One thing you should also learn about me, is I do not deal in
absolutes. If you don't understand the meanings associated with that,
then try importing yourbrain.reflection into a private namespace.


On Oct 12, 7:29 am, r <(E-Mail Removed)> wrote:
> Sarcasm anyone?


If you can't stand sarcasm, you are living on the wrong planet.

On Oct 12, 7:29 am, r <(E-Mail Removed)> wrote:
> Yes IDLE is not meant for writing million line scripts
> but who would want to anyway?


I would assume that is obvious 8=), however any editing interface may
be used for writing million line anythings -- just look at ed <http://
en.wikipedia.org/wiki/Ed_(text_editor)>.

On Oct 12, 7:29 am, r <(E-Mail Removed)> wrote:
> You may find the IDLE and
> Tkinter useless but many people find both to be indispensable
> (especially noobs). I think this is a case of champagne taste's on a
> whiskey budget for you friend!
>


You are both right and wrong: I find IDLE useless because I edit code
written in more then one (programming) language, thus any editor that
is not (more) language agnostic is useless to me, and probably every
other programmer that refuses to waste time learning an IDE per
language (and so on).

Tkinter however is not, because it is an interface to Tk . Ok, if
you have a broken display , then it is probably useless, guess you are
right on that one too.


I said I had never used Tk, not that it was useless. Depending on your
style of parsing English, one could also call me a liar (or a louse),
as I have used programs built on Tk but have never written programs
with Tk. I'll leave individual readers to determine that result.

On Oct 12, 7:29 am, r <(E-Mail Removed)> wrote:
> > > """NO TEXT EDITOR SHOULD EVER COPY AN EMPTY STRING TO THE
> > > CLIPBOARD!!"""

>
> > No, that is probably wrong.

>
> No it's exactly right and a one-liner to fix. And btw: pass the
> reefer because it ain't just whiskey clouding your mind fella!



Adding data to the clipboard belongs in the program, the decision of
*what* to place in the clipboard (generally) belongs with the user and
not to their program. Mistakenly overwriting the contents of a buffer
that you meant to retain for a longer period of time, is not the
buffers problem. Get it?


As I do not believe in absolutes, I therefore believe that there are
times where my statement is False, in this case however I believe it
is True. If you do not agree, then we have a _philosophical_
difference of opinion, and should agree to disagree.



Also the whiskey thing was an obscured reference to a song, not a
reference to my blood alcohol level. Which is probably much lower then
whoever created Tkinter from the looks of both the package and your
comments.

On Oct 12, 7:29 am, r <(E-Mail Removed)> wrote:
> Why do
> you reply to a thread about a subject you obviously don't care about?


Where I come from, one would say that you asked for feedback:

On Aug 27, 9:22 pm, r <(E-Mail Removed)> wrote:
> ---------------------------------------------
> Final Thoughts
> ---------------------------------------------
> Well, that is all i can remember for now. If you've made it this

far
> without losing your temper or your lunch well i am very

surprised .
> Anyway, give me some feedback on these ideas so maybe i can get
> motivated to submit some patches/enhancements.
>
> psst... help is welcome too ya'know



–noun
1. Electronics.
a. the process of returning part of the output of a circuit,
system, or device to the input, either to oppose the input (negative
feedback) or to aid the input (positive feedback).
....
5. Psychology. knowledge of the results of any behavior, considered
as influencing or modifying further performance. Compare biofeedback.


Now if you only wanted "Yes sir, that is a jolly good idea" types of
response, you should be more explicit about not wanting differing
opinions included.


On Oct 12, 7:29 am, r <(E-Mail Removed)> wrote:
> If you've never used Tkinter or IDLE (and never will) you have no
> reason to reply except for the trolling aspect?
>
> good day!


See the above.

Also note this: I never said I would _n_e_v_e_r_ use Tkinter.


Evaluating Tk interfaces under several languages, has been on my todo
list for a very long time. There are however other libraries with a
more pressing need to be evaluated before they are cycled into
projects.

--
TerryP.
Just Another Programmer
 
Reply With Quote
 
Mel
Guest
Posts: n/a
 
      10-12-2009
Ben Finney wrote:

> TerryP <(E-Mail Removed)> writes:
>
>> One thing you should also learn about me, is I do not deal in
>> absolutes.

>
> What, *never*? That's a pretty uncompromising position to h—
>
> I'll get my coat.


Note, he said he does not deal in absolutes. He didn't deny that he does.

Mel.


 
Reply With Quote
 
Aahz
Guest
Posts: n/a
 
      10-16-2009
In article <(E-Mail Removed)>,
Ben Finney <(E-Mail Removed)> wrote:
>TerryP <(E-Mail Removed)> writes:
>>
>> One thing you should also learn about me, is I do not deal in
>> absolutes.

>
>What, *never*?


Well, hardly ever.
--
Aahz ((E-Mail Removed)) <*> http://www.pythoncraft.com/

"To me vi is Zen. To use vi is to practice zen. Every command is a
koan. Profound to the user, unintelligible to the uninitiated. You
discover truth everytime you use it." (E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Tkinter (and IDLE) window "docking?" effect when dragging rootwindow to edge of display Jerry Hill Python 0 10-20-2010 05:44 PM
Hello and Seeking Members Interested in Global Energy Assessment Ramesh Mani C Programming 2 01-05-2009 02:03 PM
Looking for Face capture and image quality assessment SDK harishashim@gmail.com Computer Security 0 03-29-2006 09:37 AM
Better Assessment Results, Quicker and Cheaper DonMcG MCSD 2 01-28-2005 05:28 PM
Better Assessment Results, Quicker and Cheaper DonMcG Microsoft Certification 0 01-28-2005 09:25 AM



Advertisments