[Tutor] tkSimpleDialog, Tkinter, and IDLE

Kent Johnson kent37 at tds.net
Mon Feb 18 20:11:24 CET 2008

Wayne Watson wrote:
> Is tkSimpleDialog really a part of Tkinter?

It's kind of an add-on, I guess, not in the main Tkinter module:

> I sometimes see code that has:
> from tkinter import *
> import tkSimpleDialog
> The from gets all the names, functions too, so why is it importing the name tkSimpleDialog.

Because tkSimpleDialog is a separate module, not part of Tkinter proper.

> Hasn't it just been obtained with from?

In [1]: from Tkinter import *
In [2]: tkSimpleDialog
Traceback (most recent call last):
   File "<ipython console>", line 1, in <module>
<type 'exceptions.NameError'>: name 'tkSimpleDialog' is not defined

In [3]: import tkSimpleDialog
In [4]: tkSimpleDialog
Out[4]: <module 'tkSimpleDialog' from 

> When I enter import tkinter into IDLE, it objects. However, if I run a program in idle that imports it, then all is OK. What's up there?

Objects in what way? Error messages are very helpful.

IDLE is written in Tkinter so it can sometimes be a problem to develop 
Tkinter apps in IDLE. Maybe someone else can give details.


More information about the Tutor mailing list