Tkinter --> Why multiple windows

Terry Reedy tjreedy at udel.edu
Thu Mar 24 21:27:48 EDT 2016


On 3/24/2016 4:43 PM, kevind0718 at gmail.com wrote:
> On Thursday, March 24, 2016 at 4:29:03 PM UTC-4, Random832 wrote:
>> On Thu, Mar 24, 2016, at 16:24, kevind0718 at gmail.com wrote:

>>> If I run the code below two windows appear.
>>> One empty and one with the text box and button.
 >>> Why?

The answer to that sort of question is nearly always "Because that is 
what you asked for"

>> The empty one is the root window.
> I kinda guessed that.
> Is there any downside to hiding it using root.withdraw().

In your example, there is no apparent reason to hid root and use a 
Toplevel.  IDLE, however, is currently a multiwindow application with no 
main window and it uses 'root.withdraw'.

(In fact, it appears to do so twice in the IDLE process -- possibly a 
mistake.)
-- 
Terry Jan Reedy




More information about the Python-list mailing list