Message137925
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. |
|
Date |
User |
Action |
Args |
2011-06-08 21:28:03 | busfault | set | recipients:
+ busfault |
2011-06-08 21:28:03 | busfault | set | messageid: <1307568483.64.0.2959467561.issue12288@psf.upfronthosting.co.za> |
2011-06-08 21:28:03 | busfault | link | issue12288 messages |
2011-06-08 21:28:02 | busfault | create | |
|