detect keyboard input without reading it?

From: Scott Shaw (sshaw_at_twmi.rr.com)
Date: 11/09/03

  • Next message: J. Romano: "Re: detect keyboard input without reading it?"
    Date: Sun, 09 Nov 2003 17:29:31 GMT
    
    

    Hi all,
    I was wondering if you could help out with this problem that I am having.
    What I am trying to do is detect keyboard input in a while loop without
    halting/pausing the loop until the key is pressed (without hitting return).
    I looked at serveral faq's on the net and installed the cspan readkey module
    and neither seems to work most likey its me since I am getting frustrated.
    but anyway here's a sample code.

    while (1) {
        if (keypress) {
            print "you've pressed: $key\n";
        }
        else {
            print"Continuing to loop...\n";
            sleep 1; # delay the loop incase you need to control-c out.
        }
    }

    TIA!
    Scott Shaw
    sshaw@twmi.rr.com


  • Next message: J. Romano: "Re: detect keyboard input without reading it?"

    Relevant Pages

    • keyboard "interrupt"
      ... figuring out my own Python problems. ... I would like to be able to interrupt the loop or set ... various flags during execution via keyboard input. ... if there is no input in the buffer. ...
      (comp.lang.python)
    • Re: lowest number
      ... > Ok, I do understand the logic, I believe the following for loop solves it ... > from keyboard input. ...
      (comp.lang.cpp)
    • Re: keyboard "interrupt"
      ... Arnaud Delobelle wrote: ... I would like to be able to interrupt the loop or set ... various flags during execution via keyboard input. ... if there is no input in the buffer. ...
      (comp.lang.python)
    • Re: keyboard "interrupt"
      ... I have a timed loop performing certain tasks until a total period of ... I would like to be able to interrupt the loop or set ... various flags during execution via keyboard input. ... if there is no input in the buffer. ...
      (comp.lang.python)
    • Re: Writing Excel cells within Access
      ... Some sample code that may get you started (you can add loops to this code to ... loop through each worksheet in a book if you'd like). ... EXCEL workbook and reads data from it and writes the data into a recordset. ... "Bob Bonta" wrote in message ...
      (microsoft.public.access.modulesdaovba)