New submission from Tom Middleton <busfa...@gmail.com>: 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. ---------- components: Tkinter files: tkSimpleDialog.py messages: 137925 nosy: busfault priority: normal severity: normal status: open title: Python 2.7.1 tkSimpleDialog initialvalue type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file22286/tkSimpleDialog.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12288> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com