How to obtain an up-to-date document of tkinter

Terry Reedy tjreedy at udel.edu
Thu Apr 20 14:12:05 EDT 2017


On 4/20/2017 3:19 AM, Mok-Kong Shen wrote:
> Am 20.04.2017 um 02:16 schrieb breamoreboy at gmail.com:
>> On Thursday, April 20, 2017 at 1:09:45 AM UTC+1, Mok-Kong Shen wrote:
>>> How could one obtain an up-to-date document of tkinter. I ask this
>>> question because apparently there are stuffs of tkinter that
>>> worked in Python 3.5 but no longer in Python 3.6.1.
> 
>>
>> https://docs.python.org/3/library/tkinter.html
>>
>> Can you please state what worked in 3.5 but doesn't in 3.6?
> 
> Yes. In Python V.3.5, I simply had the declaration:
> 
> from tkinter import *
> and thereafter I could use in code lines e.g.:
> 
> messagebox.showerror(........)

That was not tkinter behavior.  And it was not the behavior in 2.x.

The above only worked (in 3.x) when running from IDLE, as an undesirable 
side-effect of imports made by IDLE's run.py before running user code. 
It did not work when running with Python directly, and should not have 
according to the language definition.  It was a bug in IDLE that I fixed 
for 3.5.3 (just checked), and 3.6.0.  See
https://bugs.python.org/issue25507
for an explanation.

> However, in Python V.3.6.1,

and 3.6.0 and 3.5.3

> I have to have the declaration: 
> from tkinter import *
> import tkinter.messagebox

as is normal for subpackages

> and thereafter have to use:
> 
> tkinter.messagebox.showerror(........)

or

from tkinter import messagebox
messagebox.showerror(...)

or even

from tkinter.messagebox import showerror
showerror(...)

-- 
Terry Jan Reedy



More information about the Python-list mailing list