Modernizing Python's IDLE
tkdocs.com
tkdocs.com
High-quality corporate training hinges on maximizing student engagement. This typically means having students spend time in class writing programs. (In one four day class, I've had students write >20 programs.)
IDLE is a surprisingly good tool for this.
It's cross-platform and in the standard library. It postpones questions about which is the best editor/IDE. It avoids the tab/spaces problems. In fact, it's just about the simplest tool for teaching interactive development (i.e., coding with access to a REPL.) (I should note that this style of programming is distinct from how quants and data scientists work: they write more analyses than programs/scripts. When doing corporate training for quants and data scientists, Jupyter Notebook is the only way to go.)
By the end of the class, most students are pretty tired of using IDLE. It's not a very good editor; only barely better than Notepad. As the article's screenshots show, it just looks ugly. It's not even close in functionality to an IDE or a `vim`/`emacs`+plugins. The REPL is extremely clumsy to use in practice (especially compared to `bpython` or `ipython`.) In fact, I would be shocked if anyone actually uses IDLE as part of their regular job.
That said, it's a great teaching tool, and I'm glad to see someone putting effort into improving it.
Remember reading about it, downloading, installing, launching IDLE, typing the first program and running it. Granted it was 16 years ago but that was very helpful and I remember being wow-ed by how easy, fast and simple everything was.
After I had quickly switched to emacs for actual coding, but that initial impression made a huge difference.
Here's a relevation that I only, just now, realized.
Python is named after the Monty Python gang. This I knew.
IDLE is a play off of Eric Idle. How have I never realized this before?
Most of my students start out with zero technical experience, and simple things like installing a text editor just become one more hurdle they need to get past in order to start programming. Having a decent, usable text editor bundled with the language itself will be really helpful for absolute beginners.
For those with legacy code or other constraints where it makes sense, the TkDocs site is all about getting the most out of Tk by documenting the newer pieces that people likely haven't seen.
IDLE itself is in that category of using Tk by constraint. There have been multiple forks of it, sometimes using alternate GUI toolkits. But for it to stay as part of the Python standard library, it has to only depend on other things that are part of the standard library. Which for GUI stuff, means Tkinter. And having it built into Python is a very big deal for a lot of people teaching Python, which is the main target audience.
I was really surprised by this actually - I wanted to create some simple GUI apps and assumed there would be something clean, small, and modern to replace TK... but nope. And all the documentation (including for python tk) is pretty terrible. The most realistic suggestion I've seen is... write you GUI in HTML and Javascript and use python for the backend server. Not a great situation when the best way to write a good looking GUI for Python is basically not to use Python...
A recent poll I had on the TkDocs site showed documentation is definitely the big issue for what people are trying to accomplish with Tk.
The IDE doesn't have to be written in Python (e.g. PyCharm isn't and that is probably the best Python IDE available at the moment).
IMHO, it's rather amazing, though it needs to be developed further, to support more widgets, remove bugs, etc. Sadly it did not gain much traction after release. Maybe due to not comprehensive documentation and few nasty bugs in the beginning.
I would give this library a go if I would be developing GUI application in python, though apart making few exercises, I have not used it a lot.
Major pros, that it's in python, so debugging is easy, and what is not covered with documentation, can be uncovered also. Another thing you can simply install it with pip.
Is it really that bad ?
I was really impressed the last time I did GTK+ (was a linux app small content pipeline frontend for designers) at how fast I got things done, the docs were simple and to the point [1], Glade was buggy but still usable (I had to reload after some time because it would get progressively slower as I would add/remove elements - probably a leak somewhere) I got an app with complex tree view/table/filtering etc. running within two days from 0 previous GTK+ experience.
I liked that it was a straight GUI toolkit - reminded me of VB - just create GUI elements with RAD tool and hook up callbacks in good old python - no fancy MVC, IOT learning QML and w/e. - exactly the kind of thing that lets you do apps of this size fast IMO.
[1] https://python-gtk-3-tutorial.readthedocs.org/en/latest/
Qt's like < 50 M. We aren't living in 1995. It's bindings aren't just "workable"; they are pretty good.
I guess I could see a sticking point on "simple" but IMO it's significantly easier to create a GUI using PyQt than it would be to mess with web servers and HTML to create a web based UI.
You've got a point in that web-based UIs aren't any simpler. Jupyter is a project of impressive sophistication and hard work by all involved. Really what I'm complaining about is that the move toward web-based UI has starved native GUI toolkits of interest.
I have to disagree. I've written GUIs in Qt/C++, PyQt, MFC (a long time ago), Perl/Tk, and even ltk/Common Lisp, and PyQt is the easiest of them all. There's definitely some C++ showing through in spots, but it's well hidden in most situations.
> Really what I'm complaining about is that the move toward web-based UI has starved native GUI toolkits of interest.
I have to agree with that. Most languages are lucky to have any native GUI toolkit bindings at all.
Tend to agree, funny thing though, I can use it on various versions of Win/Mac/Lin OS. The secret to Python IDLE is it just works as predicted since it came out. A clever choice of GUI.
Other than that, all looks good!