While Loop problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PythonNotSoGuru
    New Member
    • Oct 2007
    • 21

    While Loop problem

    Hi everyone. I am using a while loop in a game and during the game loop i want the user to be able to give input without the program stopping at a certain point and asking for the input. In other words i want the user to be able to input something at any time that will then be used in the program. I am using Python 2.5, English, Im on Windows XP Service Pack 2.
    Thanks for any help you could give.
  • dshimer
    Recognized Expert New Member
    • Dec 2006
    • 136

    #2
    I'm not 100% sure I follow, but it sounds like you are looking for something similar to a C getch().
    Check this out and see if there is anything useful.

    Comment

    • jlm699
      Contributor
      • Jul 2007
      • 314

      #3
      I think what he's asking is that he wants his program to simply run constantly. If a user were to press a key he wants it to act like an interrupt so that processing can switch to handle this new event before continuing with what it was doing before.

      I would be interested to see if Python can do something like this myself. As far as that link that was provided it is basically like asking for a raw_input in the sense that it waits for the user to enter something before continuing with the next line of code.

      Comment

      • kudos
        Recognized Expert New Member
        • Jul 2006
        • 127

        #4
        What kind of gui toolkit/lib do you use for your game? I did write a breakout game that uses Tkinter (that comes with python) ages ago and you can see how its done there:

        http://bytes.com/forum/thread625365-kudos.html

        -kudos

        Comment

        Working...