title: How could I set a boolean value to True, and make it so if a condition is met, it becomes False, but only for a certain amount of time?
body: <p>Seems like there should be a simple solution using the <code>time</code> module or something, but I've tried a few things and nothing seems to work. I need something like this to work:</p>
  
  <pre><code>hungry = True
  if line.find ('feeds'):
      #hungry = False for 60 seconds, then hungry is true again
  </code></pre>
  
  <p>Anyone have a solution for this?</p>
  
  <p>edit: As for what I've tried, I've tried this bit of code:</p>
  
  <pre><code>if hungry==True:
       print('yum! not hungry for 20 seconds')
       hungry = False
       i = 20
       while(i&gt;0):
           i-=1
           time.sleep(1)
           if(i==0):
               hungry = True
  </code></pre>
  
  <p>But that doesn't work because the program  just pauses until <code>hungry</code> is True again, and <code>hungry</code> being false while the program sleeps won't help; it should be false for a certain amount of time while the rest of the program works</p>
  
  <p>edit: It looks like this won't be possible without threading. I'll have to either find a new solution, or learn to use threading. Thanks for all the help anyways, I seriously appreciate it!</p>