This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author busfault
Recipients busfault
Date 2011-06-08.21:28:01
SpamBayes Score 7.73011e-09
Marked as misclassified No
Message-id <1307568483.64.0.2959467561.issue12288@psf.upfronthosting.co.za>
In-reply-to
Content
Using Tkinter under Python 2.7.1 (Windows XP FWIF)
If using the tkSimpleDialog.askinteger() function with an initialvalue = 0, the 0 is not displayed in the dialog box. The same is true for tkSimpleDialog.askfloat().

The cause of this seems to be the following:
in Lib\libi-tk\tkSimpleDialog.py (attached for convenience) 
under class _QueryDialog(Dialog)

    def body(self, master):

        w = Label(master, text=self.prompt, justify=LEFT)
        w.grid(row=0, padx=5, sticky=W)

        self.entry = Entry(master, name="entry")
        self.entry.grid(row=1, padx=5, sticky=W+E)

        if self.initialvalue:
            self.entry.insert(0, self.initialvalue)
            self.entry.select_range(0, END)

        return self.entry

The if self.initialvalue will evaluate to a FALSE when the initial value is a 0.

Changing this line to:

if self.initialvalue is not None:

fixed this issue.
I am not certain that this is as intended or a bug.
History
Date User Action Args
2011-06-08 21:28:03busfaultsetrecipients: + busfault
2011-06-08 21:28:03busfaultsetmessageid: <1307568483.64.0.2959467561.issue12288@psf.upfronthosting.co.za>
2011-06-08 21:28:03busfaultlinkissue12288 messages
2011-06-08 21:28:02busfaultcreate