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


Groups > comp.lang.python > #33890

Re: 10 sec poll - please reply!

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <michael.herrmann@getautoma.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; 'handler': 0.04; 'context': 0.05; 'much!': 0.05; 'mouse': 0.07; 'strings.': 0.07; 'url:msdn': 0.07; 'valueerror:': 0.07; 'works.': 0.07; 'api': 0.09; 'ambiguity': 0.09; 'closest': 0.09; 'friday,': 0.09; 'handler,': 0.09; 'pressing': 0.09; 'to:addr:comp.lang.python': 0.09; 'valueerror': 0.09; 'cc:addr:python-list': 0.10; 'gui': 0.11; 'background.': 0.13; 'library': 0.15; '"key"': 0.16; "(it's": 0.16; 'amiga': 0.16; 'chained': 0.16; 'character:': 0.16; 'clashes': 0.16; 'exercise:': 0.16; 'how,': 0.16; 'movements,': 0.16; 'perfect.': 0.16; 'pressed': 0.16; 'url:visualstudio': 0.16; 'world!")': 0.16; 'string': 0.17; 'wrote:': 0.17; 'certainly': 0.17; 'instance': 0.17; 'pointed': 0.17; "shouldn't": 0.17; 'thu,': 0.17; '>>>': 0.18; 'input': 0.18; 'written': 0.20; 'meant': 0.21; 'releasing': 0.22; 'url:com)': 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'cheers': 0.24; 'raise': 0.24; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'allows': 0.25; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'thanks!': 0.26; 'raw': 0.27; 'wonder': 0.27; 'subject:please': 0.27; 'thoughts': 0.27; "doesn't": 0.28; 'developing': 0.28; 'about.': 0.29; 'far.': 0.29; 'name?': 0.29; 'probably': 0.29; "i'm": 0.29; 'maybe': 0.29; 'function': 0.30; 'button': 0.30; 'point': 0.31; 'anybody': 0.32; 'could': 0.32; 'accessible': 0.33; "aren't": 0.33; 'automation': 0.33; 'controlling': 0.33; 'function.': 0.33; 'picking': 0.33; 'url:home': 0.33; 'hi,': 0.33; 'another': 0.33; 'that,': 0.34; 'agree': 0.34; 'received:google.com': 0.34; 'done': 0.34; 'thanks': 0.34; 'clear': 0.35; 'built-in': 0.35; 'nov': 0.35; 'so,': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'michael': 0.36; 'tool': 0.36; 'but': 0.36; 'wanted': 0.36; 'url:library': 0.36; 'method': 0.36; 'should': 0.36; 'thank': 0.36; 'uses': 0.37; 'being': 0.37; 'passed': 0.37; 'rather': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'some': 0.38; 'things': 0.38; 'there,': 0.38; 'several': 0.39; 'release': 0.39; 'easily': 0.39; 'called': 0.39; 'url:microsoft': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'think': 0.40; 'your': 0.60; 'url:aspx': 0.60; 'most': 0.61; 'letters': 0.62; 'between': 0.63; 'more': 0.63; 'here': 0.65; 'our': 0.65; '20,': 0.65; 'difficulty': 0.65; 'sound': 0.65; 'url:en-us': 0.65; 'wanting': 0.65; 'reply': 0.66; 'url:%1': 0.68; 'press': 0.71; 'click': 0.76; 'around,': 0.84; 'decades,': 0.84; 'distinguish': 0.84; 'injecting': 0.84; 'keystrokes': 0.84; 'mistaken': 0.84; 'dennis': 0.91; 'justice': 0.93
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=path:newsgroups:date:in-reply-to:complaints-to:injection-info :nntp-posting-host:references:user-agent:x-google-web-client :x-google-ip:mime-version:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=sKR/hmeHGXZiEd+ObvgoDDhEg2XORqwuVL2SChR1TAo=; b=ONTg2dBJcqy7htD01LDZl1HJwmuWFxKAym1I4YOfR71dXkT1CitxpKXJUVWe3cvuPs VShjihmFDIxNwa7rllentd+54ODkrRPEMO7msSIvwK8PTn85KSjO6mu378Xykx3ROTY2 DEzbsuaEetkUaaEzzRpKYM6y9UG7p7L+OjzJ6y/4ZFrrhnQJo4p5LC+9pgTw2o6sfFSl hjPemIW1BMiF6UdfLzQZJB36HVzQqv41O5dRLzrgI6ddB9NivheMl4tm7/8bqIzQL+mV 9M4cALTLCJlw1/KxmmacoDjjmk2SDUToDRp5WB5EiU0m2lnaX8VkIYOCPRMvrUe2Lffn qNZg==
Newsgroups comp.lang.python
Date Sat, 24 Nov 2012 13:07:26 -0800 (PST)
In-Reply-To <mailman.242.1353708648.29569.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=80.109.122.186; posting-account=oknH1QoAAABqzbD_5ziFTvLQsqNk2LbU
References <3d71f175-164e-494c-a521-2eaa5679b524@googlegroups.com> <818c157c-1395-441d-ad99-955a31b0d523@googlegroups.com> <mailman.242.1353708648.29569.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 80.109.122.186
MIME-Version 1.0
Subject Re: 10 sec poll - please reply!
From Michael Herrmann <michael.herrmann@getautoma.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Gm-Message-State ALoCoQmYYzwMcKhre6WH+tkns5lq8gRrdSJXITJ1b0qEt9TlN0gDFcIcA5c/r4V9o3QSXMxZtU9v
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>
Message-ID <mailman.259.1353791249.29569.python-list@python.org> (permalink)
Lines 188
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353791249 news.xs4all.nl 6930 [2001:888:2000:d::a6]:42449
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33890

Show key headers only | View raw


Thanks for your reply Dennis,

the commands sounding like they should be commands to a user is the whole point of the exercise: In doing so, we hope to make the API accessible also to users from a less technical background. You are perfectly right that system events are being generated and passed around, however that is not what these users care about. Frankly, also I coming from a very technical background don't care which events are generated and how, as long as it works. 

I agree that "key_down"/"key_up" has a nice symmetry to it. Maybe a solution could also be to use a context manager:
	with key_down(SHIFT):
		# some action...

Cheers

On Friday, November 23, 2012 11:11:34 PM UTC+1, Dennis Lee Bieber wrote:
> On Thu, 22 Nov 2012 10:00:54 -0800 (PST), Michael Herrmann
> 
> <Michael Herrmann> declaimed the following in
> 
> gmane.comp.python.general:
> 
> 
> 
> > These names aren't perfect. As Emile rightly pointed out, several tools distinguish between 'press' and 'release' and a user might wonder how to release a key that was pressed using 'press'. That's an ambiguity that is certainly there, however we hope that once the user has at least seen
> 
> > 	press(ENTER)
> 
> > it is clear what is meant. Distinguishing between pressing and releasing could we think easily be done with, say
> 
> > 	hold_down(SHIFT)
> 
> > 	...
> 
> > 	release(SHIFT)
> 
> > Another ambiguity of 'press' that I pointed out in my original mail is that it could also be understood as "pressing a button". The current idea is to raise a ValueError if the user supplies a string that is longer than one character:
> 
> > 	>>> press("OK")
> 
> > 	ValueError: 'press' generates keystrokes and can only press single letters at a time. Did you maybe mean click("OK") or press('O', 'K')?
> 
> > 
> 
> 
> 
> 	"press", "hold_down", "release" just sound so much like they should
> 
> be commands to a /user/ not to a means of programmatically controlling
> 
> an interface. A "user" presses a button -- but a program is just
> 
> injecting the "event" of a button press into the input processing stream
> 
> (it's been decades, but I still think in Amiga terms -- where all input
> 
> events routed through one input handler and chained to the programs
> 
> wanting to work with raw events... This meant that, but injecting the
> 
> event codes before the input handler, a program could make another
> 
> program [including the OS] think one had ejected/inserted floppies,
> 
> mouse movements, keystrokes)
> 
> 
> 
> 	"hold_down" and "release" would seem more memorable, and symmetric,
> 
> if named "key_down" and "key_up"; and if "press" is limited to single
> 
> codes -- "key" [or "keystroke"]
> 
> 
> 
> 	The closest M$ .Net method is called SendKeys() and works with
> 
> strings.
> 
> http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.uitesting.keyboard.sendkeys%28v=vs.100%29.aspx
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> > What do you think of this solution? I hope anybody read this far. I probably shouldn't have written that much but wanted to do justice to your inputs.
> 
> > 
> 
> > Thanks!
> 
> > 
> 
> > Michael
> 
> > 
> 
> > On Tuesday, November 20, 2012 1:18:38 PM UTC+1, Michael Herrmann wrote:
> 
> > > Hi, 
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > I'm developing a GUI Automation library (http://www.getautoma.com) and am having difficulty picking a name for the function that simulates key strokes. I currently have it as 'type' but that clashes with the built-in function. Example uses of 'type': 
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > type(ENTER)
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > type("Hello World!")
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > type(CTRL + 'a')
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > What, in your view, would be the most intuitive alternative name?
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > Here are my thoughts so far: I could call it 'press' but then our GUI automation tool also allows you to click things and then "press" might be mistaken for "pressing a button". A less ambiguous alternative is "type_keys" but that is rather long and doesn't read as well, for instance in type_keys(ENTER).
> 
> > > 
> 
> > > 
> 
> > > 
> 
> > > Thank you very much!
> 
> -- 
> 
> 	Wulfraed                 Dennis Lee Bieber         AF6VN
> 
>             HTTP://wlfraed.home.netcom.com/

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


Thread

10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-20 04:18 -0800
  Re: 10 sec poll - please reply! Chris Angelico <rosuav@gmail.com> - 2012-11-20 23:23 +1100
  Re: 10 sec poll - please reply! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-20 13:09 +0000
  Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-20 05:17 -0800
  Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-20 05:20 -0800
  Re: 10 sec poll - please reply! Dave Angel <davea@dejaviewphoto.com> - 2012-11-20 08:39 -0500
    Re: 10 sec poll - please reply! Neil Cerutti <neilc@norwich.edu> - 2012-11-20 14:39 +0000
  Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-20 07:18 -0800
    Re: 10 sec poll - please reply! MRAB <python@mrabarnett.plus.com> - 2012-11-20 15:59 +0000
    Re: 10 sec poll - please reply! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-20 16:21 +0000
      Re: 10 sec poll - please reply! Chris Angelico <rosuav@gmail.com> - 2012-11-21 07:57 +1100
      RE: 10 sec poll - please reply! "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-20 21:08 +0000
        Re: 10 sec poll - please reply! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-21 01:20 +0000
          Re: 10 sec poll - please reply! Tim Chase <python.list@tim.thechases.com> - 2012-11-20 19:39 -0600
    Re: 10 sec poll - please reply! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-20 16:31 +0000
    Re: 10 sec poll - please reply! Alan Meyer <ameyer2@yahoo.com> - 2012-11-20 18:46 -0500
      Re: Re: 10 sec poll - please reply! Evan Driscoll <driscoll@cs.wisc.edu> - 2012-11-20 19:51 -0600
    Re: 10 sec poll - please reply! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-20 19:01 -0500
    Re: 10 sec poll - please reply! Alan Bawden <alan@scooby-doo.csail.mit.edu> - 2012-11-20 21:15 -0500
  Re: 10 sec poll - please reply! John Gordon <gordon@panix.com> - 2012-11-20 16:09 +0000
    Re: 10 sec poll - please reply! Dave Angel <d@davea.name> - 2012-11-20 11:19 -0500
  Re: 10 sec poll - please reply! emile <emile@fenx.com> - 2012-11-20 08:21 -0800
    Re: 10 sec poll - please reply! mherrmann.at@gmail.com - 2012-11-20 08:29 -0800
      How to use the python to do the unit test "yujian4newsgroup@gmail.com" <yujian4newsgroup@gmail.com> - 2012-11-21 01:40 +0800
      Re: How to use the python to do the unit test emile <emile@fenx.com> - 2012-11-20 09:51 -0800
      Re: 10 sec poll - please reply! xDog Walker <thudfoo@gmail.com> - 2012-11-20 13:33 -0800
      Re: How to use the python to do the unit test Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-20 22:02 +0000
    Re: 10 sec poll - please reply! mherrmann.at@gmail.com - 2012-11-20 08:29 -0800
  Re: 10 sec poll - please reply! Tim Chase <python.list@tim.thechases.com> - 2012-11-20 18:00 -0600
    Re: 10 sec poll - please reply! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-21 01:17 +0000
      Re: 10 sec poll - please reply! Tim Chase <python.list@tim.thechases.com> - 2012-11-20 19:30 -0600
      Re: 10 sec poll - please reply! Hans Mulder <hansmu@xs4all.nl> - 2012-11-21 13:33 +0100
  Re: 10 sec poll - please reply! rh <richard_hubbe11@lavabit.com> - 2012-11-20 21:25 -0800
  Re: 10 sec poll - please reply! Chris Angelico <rosuav@gmail.com> - 2012-11-21 17:35 +1100
    Re: 10 sec poll - please reply! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-21 07:01 +0000
      Re: 10 sec poll - please reply! Andrew Cooper <andrew@nospam.example.com> - 2012-11-21 22:24 +0000
  Re: 10 sec poll - please reply! markus.moldaschl@gmail.com - 2012-11-21 01:29 -0800
  Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-21 09:19 -0800
  Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-22 10:00 -0800
    Re: 10 sec poll - please reply! Chris Angelico <rosuav@gmail.com> - 2012-11-23 06:08 +1100
      Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-22 13:45 -0800
      Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-22 13:45 -0800
    Re: 10 sec poll - please reply! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-23 05:41 +0000
      Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-23 01:08 -0800
        Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-23 08:15 -0800
    Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-23 05:42 -0800
      Re: 10 sec poll - please reply! Kwpolska <kwpolska@gmail.com> - 2012-11-23 17:42 +0100
        Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-23 09:29 -0800
        Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-23 09:29 -0800
      Re: 10 sec poll - please reply! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-23 22:30 +0000
        Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-24 12:56 -0800
          Re: 10 sec poll - please reply! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-24 18:22 -0500
            Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-25 05:41 -0800
    Re: 10 sec poll - please reply! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-23 17:10 -0500
      Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-24 13:07 -0800
        Re: 10 sec poll - please reply! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-25 03:56 +0000
          Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-25 05:45 -0800
      Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-24 13:07 -0800
  Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-24 13:59 -0800
  Re: 10 sec poll - please reply! ALeX inSide <alex.b.inside@gmail.com> - 2012-11-25 04:13 -0800
  Re: 10 sec poll - please reply! Michael Herrmann <michael.herrmann@getautoma.com> - 2012-11-29 03:45 -0800

csiph-web