Tkinter colorchooser problems (revisited)

23 Jul, 2020

Suranga writes:

My son and I have been learning Python with your great book. Unfortunately, we hit an issue with Colorchooser - the problem appears identical to this one: https://jasonrbriggs.com/journal/2013/05/01/tkinter-colorchooser-problems.html In the solution, you suggest we revisit Chapter 1 but can see no mention of a way to ensure IDLE is launched with No Subprocesses. Have we missed something here? Perhaps there was an earlier version of the book that did not contain this? (ours is the Tenth Printing). Thanks for any guidance you can provide!

No, you haven't missed anything. In subsequent printings of the book, my advice about using "No subprocess" has been removed -- that mode is no longer valid with the versions of Python 3 released since Python for Kids came out in 2012.

Interestingly, despite the fact all the code in the original print was tested by multiple people (including me!), I can't now find a version of python where from tkinter import * actually results in colorchooser.askcolor() working properly. So in yet later printings (some time after Jan 2017), I changed the instructions to reflect that fact that colorchooser is not imported by default when using import *.

This is now the corrected code:

from tkinter import *
from tkinter import colorchooser
tk = Tk()
tk.update()
colorchooser.askcolor()