User Tools

Site Tools


python_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
python_functions [2023/01/20 01:41] – [Input Functions] g00r00python_functions [2023/01/20 01:55] – [Input Functions] g00r00
Line 166: Line 166:
 | [[python_functions#Function: GETSTR|getstr]]         | Get string input from the user                   | | [[python_functions#Function: GETSTR|getstr]]         | Get string input from the user                   |
 | [[python_functions#Function: KEYPRESSED|keypressed]] | Check if input is available from user            | | [[python_functions#Function: KEYPRESSED|keypressed]] | Check if input is available from user            |
 +| [[python_functions#Function: ONEKEY|onekey]]         | Get constrained single character input from user |
  
 === Function: GETSTR === === Function: GETSTR ===
Line 212: Line 213:
       if keypressed is True:       if keypressed is True:
         writeln("A key is waiting!")         writeln("A key is waiting!")
 +
 +=== Function: ONEKEY ===
 +
 +    Syntax: onekey (keylist, echo) : string
 +    
 +    This function asks the user to input a character but accepts only input
 +    from the user that matches a character in the keylist.  If echo is True
 +    the function will print the character to the terminal.
 +            
 +    Example:
 +  
 +      ch = onekey(chr(13) + "APQ", True);
 +      
 +      if ch == 'A':
 +           writeln("User pressed A")
 +      
 +     The above example prompts the user to enter one of the keys A, P, Q or
 +     the ENTER key (ASCII #13).  Because echo is True, it will prompt the
 +     character to the terminal before returning the key that was pressed.
 +     
 +     User input for this function is not case sensitive.
  
 ---- ----
Line 301: Line 323:
   * isuserpw   * isuserpw
   * isvalidpw   * isvalidpw
-  * keypressed+  * [[python_functions#Function: KEYPRESSED|keypressed]]
   * logerror   * logerror
   * mci2str   * mci2str
python_functions.txt · Last modified: 2023/01/20 01:57 by g00r00

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki