Re: [Tkinter-discuss] tkinter Entry validation: insert instead of replace

2013-02-22 Thread Michael Lange
On Sat, 23 Feb 2013 05:35:24 +0600 Doc Lans wrote: > I removed your focus bind and all Entries work fine for me. I cannot > insert something incorrect and cannot leave Entries blank. I'm glad I could help. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. .

Re: [Tkinter-discuss] tkinter Entry validation: insert instead of replace

2013-02-22 Thread Doc Lans
I removed your focus bind and all Entries work fine for me. I cannot insert something incorrect and cannot leave Entries blank. import Tkinter class IntEntry(Tkinter.Entry): def __init__(self, master=None, value=0, **kw): Tkinter.Entry.__init__(self, master, **kw) self._oldval

Re: [Tkinter-discuss] tkinter Entry validation: insert instead of replace

2013-02-22 Thread Michael Lange
On Fri, 22 Feb 2013 21:59:50 +0600 Teodor the Thinker wrote: > Thank you. It was so simple! I changed function return to > return P.isdigit() or (P == "") > and it seems work. > > But it allows empty string not only during editing. I want to make: > when i clear the Entry and switch to another G

Re: [Tkinter-discuss] tkinter Entry validation: insert instead of replace

2013-02-22 Thread Teodor the Thinker
Thank you. It was so simple! I changed function return to return P.isdigit() or (P == "") and it seems work. But it allows empty string not only during editing. I want to make: when i clear the Entry and switch to another GUI element Entry rollbacks to last valid value. But obvious code to achiev

Re: [Tkinter-discuss] tkinter Entry validation: insert instead of replace

2013-02-22 Thread Michael Lange
Hi, On Fri, 22 Feb 2013 01:50:45 -0800 (PST) lansman wrote: > Anybody know why it happens? this is a common issue. To illustrate what's going on, I changed your validate callback a little into: def _validate(self, d, i, P, s, S, v, V, W): print '"%s"' % P, P.isdigit() retu

[Tkinter-discuss] tkinter Entry validation: insert instead of replace

2013-02-22 Thread lansman
Here is simple Python/Tkinter program with single Entry widget that i want automatically check is number entered or not. http://pastebin.com/WkLy2Csb print statement in _validate() function only for debugging. The problem is in this case visual editing of Entry is