Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91067

Re: need help with an accessibility prototype

Path csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <lac@openend.se>
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; 'modified': 0.05; 'tries': 0.05; 'key.': 0.07; 'keys,': 0.07; 'mouse': 0.07; 'msg': 0.07; 'welcome.': 0.07; 'subject:help': 0.07; 'hacking,': 0.09; 'key)': 0.09; 'label,': 0.09; 'non-ascii': 0.09; 'pointers': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'subject:skip:a 10': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.14; "%r'": 0.16; 'bind': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'considers': 0.16; 'determining': 0.16; 'event.keysym': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:89.233': 0.16; 'received:89.233.217': 0.16; 'received:89.233.217.133': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'tk()': 0.16; 'uses,': 0.16; 'looked': 0.16; 'char': 0.18; 'detect': 0.18; 'laura': 0.18; 'subject:need': 0.18; 'widget': 0.18; 'gui': 0.18; 'input': 0.18; 'windows': 0.20; 'cc:addr:python.org': 0.21; 'cc:2**1': 0.22; 'either.': 0.22; 'tkinter': 0.22; 'bit': 0.23; '2015': 0.23; "haven't": 0.24; "i've": 0.24; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'long,': 0.24; 'written': 0.24; 'second': 0.24; '----------': 0.25; 'idea': 0.26; 'separate': 0.27; 'interface': 0.29; 'received:se': 0.29; 'cc:no real name:2**1': 0.29; 'fri,': 0.31; 'lab': 0.31; 'window': 0.31; 'code': 0.31; 'run': 0.32; 'help,': 0.32; 'programming,': 0.33; 'file': 0.34; 'eric': 0.35; 'text.': 0.35; 'unicode': 0.35; 'but': 0.36; 'being': 0.36; 'text': 0.36; 'url:org': 0.36; 'should': 0.37; 'display': 0.37; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'manual': 0.38; 'rather': 0.38; 'building': 0.38; 'say': 0.38; 'test': 0.39; 'things': 0.39; 'subject:with': 0.40; 'some': 0.40; 'your': 0.60; 'simple': 0.61; 'header:Message-Id:1': 0.62; 'here:': 0.62; 'skip:n 10': 0.63; 'different': 0.64; 'box.': 0.66; 'capture': 0.66; 'online': 0.71; 'special': 0.72; 'prompt': 0.79; 'received:89': 0.80; 'odd,': 0.84; 'start.': 0.84; 'mean.': 0.91; 'old.': 0.95
To "Eric S. Johansson" <esj@harvee.org>
cc python-list@python.org, lac@openend.se
From Laura Creighton <lac@openend.se>
Subject Re: need help with an accessibility prototype
In-Reply-To Message from "Eric S. Johansson" <esj@harvee.org> of "Fri, 22 May 2015 12:29:20 -0400." <555F5960.9030501@harvee.org>
References <555F5960.9030501@harvee.org>
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-ID <10040.1432324203.1@fido>
Content-Transfer-Encoding quoted-printable
Date Fri, 22 May 2015 21:50:03 +0200
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [89.233.217.130]); Fri, 22 May 2015 21:50:08 +0200 (CEST)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.237.1432324217.17265.python-list@python.org> (permalink)
Lines 55
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432324217 news.xs4all.nl 2845 [2001:888:2000:d::a6]:33676
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91067

Show key headers only | View raw


In a message of Fri, 22 May 2015 12:29:20 -0400, "Eric S. Johansson" writes:
>2 needs.  first is determining if NaturallySpeaking injects keycodes or 
>ascii char into the windows input queue.  second is building a test 
>widget to capture and display text.
>
>I think I can solve both of these by building a simple text widget 
>(tkinter? qt? ??) to capture keycodes.  problem, is in <mumble><mumble> 
>yrs of programming, I've never written a GUI interface so I have no idea 
>where to start.  help, tutor, pointers to samples would be most welcome.
>
>--- eric

The best online manual I know of for Tkinter is here:
http://effbot.org/tkinterbook/ despite being 10 years old.  But then I
haven't looked for one for about that long, either.

For tkinter key events are a  bit odd, given that Tkinter tries to
help you and considers special keys, punctuation and non-ascii printing
characters as separate things should you want to bind to them.

It's actually easier to write the code and say 'play with this' rather
than to explain when you would need to use event.char and when event.keysym
(Plus the code will tell you what Tkinter uses, I might remember wrong.)

Save this in a file and run it.

from Tkinter import *
root = Tk()
prompt = 'Press any key.  Remember to keep your mouse in the cyan box. '
lab = Label(root, text=prompt, width=len(prompt), bg='cyan')
lab.pack()

def key(event):
    msg = 'event.char is %r and event.keysym is %r' % (event.char, event.keysym)
        lab.config(text=msg)

root.bind_all('<Key>', key)
root.mainloop()

----------
If you need to put unicode chars in your label, that's a different probem.
If knowing when a control or alt-gr key is released is important to you,
the code will have to be modified to detect this specially.  Type some
control chars at the cyan window and you will see what I mean.

Happy Hacking,
Laura

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: need help with an accessibility prototype Laura Creighton <lac@openend.se> - 2015-05-22 21:50 +0200

csiph-web