[Tutor] Why does "window = tk.Tk()" open a tkinter window when typed in the Python interpreter?

Alan Gauld alan.gauld at yahoo.co.uk
Fri Aug 28 18:54:16 EDT 2020


On 28/08/2020 22:22, Richard Damon wrote:

>> Perhaps I should phrase the question differently:  Why does this
>> happen in the interpreter but does *not* happen if I run a program
>> without calling window.mainloop()?
>>
> Because Python when in interactive mode uses tkinter, and has a main
> loop of it own that will pump your messages if you don't
Nope, the regular Python interpreter does not use tkinter,
nor even need tkinter to be installed.

This may require some examination of the source.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list