From cazaw_wow at yahoo.com Thu Oct 29 18:43:33 2009 From: cazaw_wow at yahoo.com (Cazaw) Date: Thu, 29 Oct 2009 10:43:33 -0700 (PDT) Subject: [PythonCE] kbhit type of functionality in PythonCE Message-ID: <26114814.post@talk.nabble.com> I've had only very limited exposure to Python and began only yesterday with PythonCE, so I'm definitely a newbie at it all. My question seems really basic, but I've not been able to find a simple answer: I have a small program that does a raw_input, processes the entered information and then displays the results. Currently I have it so that after displaying the results it does the raw_input again to get more information to process or, if the input is nothing, end. But the problem is that the raw_input window takes up much of the screen and thus hides most of the previous results. Is there some way to have the program loop/wait/sleep/whatever until any key is pressed and then put up the raw_input window? It's rather frustrating to be 99% of the way to the desired goal and unable to figure out that last little bit. I'm using PythonCE 2.5 on a Samsung/ATT SGH-i907 running Windows Mobile 6.1 Professional with an ARM920T PXA311 process and 107.94Mb of RAM. Thanks in advance for any help. -- View this message in context: http://www.nabble.com/kbhit-type-of-functionality-in-PythonCE-tp26114814p26114814.html Sent from the Python - pythonce mailing list archive at Nabble.com. From cazaw_wow at yahoo.com Thu Oct 29 20:11:58 2009 From: cazaw_wow at yahoo.com (Cazaw) Date: Thu, 29 Oct 2009 12:11:58 -0700 (PDT) Subject: [PythonCE] kbhit type of functionality in PythonCE In-Reply-To: <26114814.post@talk.nabble.com> References: <26114814.post@talk.nabble.com> Message-ID: <26119052.post@talk.nabble.com> p.s. - Alternately, if the raw_input could show up in the stdout along with the displayed results instead of it's own dialog box, that would be just fine and eliminate the problem. Whichever way would be easiest. -- View this message in context: http://www.nabble.com/kbhit-type-of-functionality-in-PythonCE-tp26114814p26119052.html Sent from the Python - pythonce mailing list archive at Nabble.com. From adam.walley at gmail.com Thu Oct 29 21:42:46 2009 From: adam.walley at gmail.com (Adam Walley) Date: Thu, 29 Oct 2009 20:42:46 +0000 Subject: [PythonCE] kbhit type of functionality in PythonCE In-Reply-To: <26119052.post@talk.nabble.com> References: <26114814.post@talk.nabble.com> <26119052.post@talk.nabble.com> Message-ID: <518d94ee0910291342r189c80d2v4be420cbe2487023@mail.gmail.com> Hi, Cazaw. Welcome to PythonCE. I remember wrestling with similar issues with the raw_input. AFAIK its features are very limited and it does rather awkwardly appear over the PythonCE window. You can, of course, position your text output with some spacing. If you are satisfied with just a pause before the raw_input window appears then you can import the time module and use the sleep function (although this tends to make the OS think the app is not responding). I usually create a simple loop function instead, when using this method. It would define a pause function and look something like this: def pause(t): t0=time.time() while time.time()-t0 > > p.s. - Alternately, if the raw_input could show up in the stdout along with > the displayed results instead of it's own dialog box, that would be just > fine and eliminate the problem. Whichever way would be easiest. > -- > View this message in context: > http://www.nabble.com/kbhit-type-of-functionality-in-PythonCE-tp26114814p26119052.html > Sent from the Python - pythonce mailing list archive at Nabble.com. > > _______________________________________________ > PythonCE mailing list > PythonCE at python.org > http://mail.python.org/mailman/listinfo/pythonce > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cazaw_wow at yahoo.com Fri Oct 30 14:22:37 2009 From: cazaw_wow at yahoo.com (Cazaw) Date: Fri, 30 Oct 2009 06:22:37 -0700 (PDT) Subject: [PythonCE] kbhit type of functionality in PythonCE In-Reply-To: <518d94ee0910291342r189c80d2v4be420cbe2487023@mail.gmail.com> References: <26114814.post@talk.nabble.com> <26119052.post@talk.nabble.com> <518d94ee0910291342r189c80d2v4be420cbe2487023@mail.gmail.com> Message-ID: <26130018.post@talk.nabble.com> Adam Walley: Not really what I was hoping for but I took your idea and built on it so that if the response to the raw_input is an empty string it repeats the pause. Good enough. Thanks! Adam Walley wrote: > > Hi, Cazaw. > > Welcome to PythonCE. I remember wrestling with similar issues with the > raw_input. AFAIK its features are very limited and it does rather > awkwardly > appear over the PythonCE window. You can, of course, position your text > output with some spacing. > > If you are satisfied with just a pause before the raw_input window appears > then you can import the time module and use the sleep function (although > this tends to make the OS think the app is not responding). I usually > create > a simple loop function instead, when using this method. It would define a > pause function and look something like this: > > def pause(t): > t0=time.time() > while time.time()-t0 pass > > where 't' is the number of seconds to pause (and can be a decimal if > needed). Then you just call the pause function at the point in your code > where you want to wait. > > Unfortunately, I think that any other method whereby (hard or soft) key or > stylus input is used would be non-trivial and requires quite a bit more > effort. > > If you have the time to put into it, I would suggest looking into the > PocketPyGUI package or compiling the SDL library and using that (I have > some > info on using SDL with PythonCE here: watersprite.awardspace.com/python). > Perhaps other list members have some other suggestions? > > Adam. > 2009/10/29 Cazaw > >> >> p.s. - Alternately, if the raw_input could show up in the stdout along >> with >> the displayed results instead of it's own dialog box, that would be just >> fine and eliminate the problem. Whichever way would be easiest. >> -- >> View this message in context: >> http://www.nabble.com/kbhit-type-of-functionality-in-PythonCE-tp26114814p26119052.html >> Sent from the Python - pythonce mailing list archive at Nabble.com. >> >> _______________________________________________ >> PythonCE mailing list >> PythonCE at python.org >> http://mail.python.org/mailman/listinfo/pythonce >> > > _______________________________________________ > PythonCE mailing list > PythonCE at python.org > http://mail.python.org/mailman/listinfo/pythonce > > -- View this message in context: http://old.nabble.com/kbhit-type-of-functionality-in-PythonCE-tp26114814p26130018.html Sent from the Python - pythonce mailing list archive at Nabble.com.