An assessment of Tkinter and IDLE

TerryP bigboss1964 at gmail.com
Mon Oct 12 07:43:32 CEST 2009


On Aug 27, 9:22 pm, r <rt8... at gmail.com> 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 <rt8... at gmail.com> 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 <rt8... at gmail.com> 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 <rt8... at gmail.com> 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? :-P.

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 <rt8... at gmail.com> 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"
unix at cli.users.org` 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



More information about the Python-list mailing list