[New-bugs-announce] [issue39171] Missing default root in tkinter simpledialog.py

Dominic Mayers report at bugs.python.org
Tue Dec 31 03:15:47 EST 2019


New submission from Dominic Mayers <dominic_mayers at yahoo.com>:

My first "bug" report here. Not sure I am doing it right. It is just that if I execute the code

    import tkinter
    from tkinter import simpledialog
    tkinter.Tk().withdraw() 
    integer_value = simpledialog.askinteger('Dialog Title', 'What is your age?', minvalue=0, maxvalue=100)

It works. In particular, when the line `parent = tkinter._default_root` is executed in simpledialog.py, `_default_root` is defined.  However, if I execute the code

    import tkinter
    from tkinter import simpledialog
    integer_value = simpledialog.askinteger('Dialog Title', 'What is your age?', minvalue=0, maxvalue=100)

which does not have the line `tkinter.Tk().withdraw()` it does not work. When the line `parent = tkinter._default_root` is executed, `_default_root` is not defined. 

I don't know if it is a bug. I don't understand the remainder of the code enough to say. However, the purpose of this line is to define a parent when none is provided. It seem to me that it should be possible to find a parent window...

----------
components: Tkinter
messages: 359106
nosy: dominic108
priority: normal
severity: normal
status: open
title: Missing default root in tkinter simpledialog.py
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39171>
_______________________________________


More information about the New-bugs-announce mailing list