title: How to quit the program in while loop using push-button in PyQt
body: <p>I have the following code which will start after clicking the 'Start' button in PyQt:</p>
  
  <pre><code>def Start(self):
    import time
    import os
    import RPi.GPIO as GPIO
    import datetime
  
    GPIO.setmode(GPIO.BCM)
    DEBUG = 1
  
    os.system('clear')
  
    # SPI port on GPIO
    SPICLK = 18
    SPIMISO = 23
    SPICS = 25
  
    # set up the SPI interface pins
    GPIO.setup(SPIMISO, GPIO.IN)
    GPIO.setup(SPICLK, GPIO.OUT)
    GPIO.setup(SPICS, GPIO.OUT)
  
    GPIO.output(SPICS, True)
    GPIO.output(SPICS, False) # bring CS low
    while True:
          adcout = 0             
          read_adc = 0
          #s=time.clock()
          for i in range(25):
              GPIO.output(SPICLK, True)
              GPIO.output(SPICLK, False)
              adcout &lt;&lt;= 1
              if (GPIO.input(SPIMISO)==1):
                  adcout |= 0x1
          time.sleep(0.085)   
          if (GPIO.input(SPIMISO)==0):
              read_adc = adcout
              millivolts = read_adc * ( 2500.0 /(pow(2,22)))
              read_adc = "%d" % read_adc
              millivolts = "%d" % millivolts
  
          if DEBUG:
              print millivolts, "mV (ADC)"
  </code></pre>
  
  <p>The above program is for ADC reading and it will start after clicking the pushbutton called 'Start' as : <code>self.pushButton.clicked.connect( self.Start)</code></p>
  
  <p>And I have another <code>pushButton_2</code> called 'Stop' and by clicking this the above process should stop.Please suggest, so I can able to do that.</p>