Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28213
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <arnodel@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'root': 0.04; 'subject:bug': 0.05; 'bug.': 0.07; 'function,': 0.07; 'suppress': 0.07; 'tkinter': 0.07; 'python': 0.09; 'inserted': 0.09; 'received :mail-vc0-f174.google.com': 0.09; 'bug': 0.10; 'cc:addr:python- list': 0.10; 'def': 0.10; '"break"': 0.16; 'bind': 0.16; 'incomplete': 0.16; 'lot!': 0.16; 'navigating': 0.16; 'subject:Entry': 0.16; 'subject:Tkinter': 0.16; 'to:addr:web.de': 0.16; 'wrote:': 0.17; 'widget': 0.17; 'url:edu': 0.18; 'input': 0.18; 'bit': 0.21; 'import': 0.21; 'event,': 0.22; 'cc:2**0': 0.23; "haven't": 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'guess': 0.27; 'prevent': 0.27; 'message- id:@mail.gmail.com': 0.27; 'piece': 0.29; 'received:209.85.220.174': 0.29; 'probably': 0.29; 'link.': 0.30; 'web.': 0.30; 'function': 0.30; '(and': 0.32; 'could': 0.32; 'print': 0.32; 'cancel': 0.33; 'docs': 0.33; 'problem': 0.33; 'knowledge': 0.33; 'entry': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'characters': 0.36; 'should': 0.36; 'being': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'little': 0.39; 'header:Received:5': 0.40; 'easy': 0.60; 'back': 0.62; 'press': 0.71; 'url:help': 0.72; 'funny': 0.78; 'otten': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=pvtMwfXfdJ8EXsCOivsiAChSIQPTkYsyZ/AzXXH8v5A=; b=C2RkLKX52iiNCOcSH2g/C7p+Ffuh8O+ph2XzF2jnlGLLnfZF3+yYNBIuSXm+FYHhBh fiYWiuv30w6XDg5kkBEXiYglXpXgK21YMZfxUgT+Fx4jXfGiQKlNDBn6rle2BSKl+NxL M590XBncTnve3Yc794szKDZ9KKLo+HncosqaAn3uuocZNEPdzbfBP9f5rTXmdEF6Acea ovwgzG8KRFzX+Ce+TsxQX9NDsffVpkxiPyanY7lzG1tR1EGlbSkS20NPnrFt4QvwEhO8 yEFqwZUj/4uOwEQOw2KTF3mLUWbhlAdUShsNacSn5hFiPEkomgij5c+zEJ4JelR4TKkT zC0Q== |
| MIME-Version | 1.0 |
| In-Reply-To | <k1so4h$vlq$1@ger.gmane.org> |
| References | <mailman.4004.1346408318.4697.python-list@python.org> <k1qhgn$me0$1@dont-email.me> <mailman.4.1346426294.27098.python-list@python.org> <k1qkpa$d1g$1@dont-email.me> <hW40s.4177$905.750@fx27.am4> <624248hoth2ih6bu6jvnvehokbenn0a555@invalid.netcom.com> <CAJ6cK1aM_4Num7V6=hxrLLLs0-VpzXh42v+jWz5x9xcN-3XXPQ@mail.gmail.com> <k1so4h$vlq$1@ger.gmane.org> |
| Date | Sat, 1 Sep 2012 13:56:32 +0100 |
| Subject | Re: Tkinter bug in Entry widgets on OS X |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| To | Peter Otten <__peter__@web.de> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.33.1346504196.27098.python-list@python.org> (permalink) |
| Lines | 49 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1346504196 news.xs4all.nl 6966 [2001:888:2000:d::a6]:56282 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:28213 |
Show key headers only | View raw
On 1 September 2012 11:30, Peter Otten <__peter__@web.de> wrote:
> Arnaud Delobelle wrote:
>> It would be good if I could intercept the key press event and cancel its
>> action on the Entry widget. It's easy to intercept the key event, but I
>> haven't found out how to prevent the funny characters from being inserted
>> into the Entry widget input area.
>
> Untested as I have no Mac:
>
> import Tkinter as tk
>
> def suppress(event):
> if event.keycode in {111, 116}:
> print "ignoring", event.keycode
> return "break"
> print event.keycode, "accepted"
>
> root = tk.Tk()
> entry = tk.Entry(root)
> entry.bind("<Key>", suppress)
> entry.pack()
>
> root.mainloop()
This works fine!
return "break" is the piece of knowledge that I was missing. Thanks a
lot! In fact I lied a bit in my original message - I do use the UP
and DOWN arrows on one Entry widget for navigating its command
history. To do this I was binding the "<Up>" and "<Down>" events to a
function, which simply has to return "break" to work around the bug.
On other Entry widgets, I just bind "<Up>" and "<Down>" to a suppress
function which simply returns "break".
>> I've struggled to find good tkinter
>> docs on the web.
>
> For my (basic) needs I keep coming back to
>
> http://infohost.nmt.edu/tcc/help/pubs/tkinter/
Thanks for the link. I was using the docs on effbot which are nice
but probably incomplete (and old).
I guess I should flag up this bug but I don't even know if it's a
Python or Tk problem and have little time or expertise to investigate.
--
Arnaud
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Tkinter bug in Entry widgets on OS X Arnaud Delobelle <arnodel@gmail.com> - 2012-08-31 11:18 +0100
Re: Tkinter bug in Entry widgets on OS X Kevin Walzer <kw@codebykevin.com> - 2012-08-31 10:25 -0400
Re: Tkinter bug in Entry widgets on OS X Arnaud Delobelle <arnodel@gmail.com> - 2012-08-31 16:18 +0100
Re: Tkinter bug in Entry widgets on OS X Kevin Walzer <kw@codebykevin.com> - 2012-08-31 11:21 -0400
Re: Tkinter bug in Entry widgets on OS X Alister <alister.ware@ntlworld.com> - 2012-08-31 15:41 +0000
Re: Tkinter bug in Entry widgets on OS X Arnaud Delobelle <arnodel@gmail.com> - 2012-08-31 20:05 +0100
Re: Tkinter bug in Entry widgets on OS X Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-31 15:30 -0400
Re: Tkinter bug in Entry widgets on OS X Peter Otten <__peter__@web.de> - 2012-09-01 12:30 +0200
Re: Tkinter bug in Entry widgets on OS X Arnaud Delobelle <arnodel@gmail.com> - 2012-09-01 13:56 +0100
Re: Tkinter bug in Entry widgets on OS X "Russell E. Owen" <rowen@uw.edu> - 2012-09-13 13:33 -0700
csiph-web