[PythonCE] kbhit type of functionality in PythonCE

2009-10-29 Thread Cazaw

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.

___
PythonCE mailing list
PythonCE@python.org
http://mail.python.org/mailman/listinfo/pythonce


Re: [PythonCE] kbhit type of functionality in PythonCE

2009-10-29 Thread Adam Walley
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()-t0t:
  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 cazaw_...@yahoo.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.

 ___
 PythonCE mailing list
 PythonCE@python.org
 http://mail.python.org/mailman/listinfo/pythonce

___
PythonCE mailing list
PythonCE@python.org
http://mail.python.org/mailman/listinfo/pythonce