import RPi.GPIO as GPIO
from time import sleep

button = 17
preState = False
GPIO.setmode(GPIO.BCM)
GPIO.setup(button, GPIO.IN)

while True:
    buttonValue = GPIO.input(button)
    if buttonValue == True:
        preState = not preState
        print("button 1 is pressed")
        while GPIO.input(button) == True:
            pass
            # Increase this value to slow down button reads
            sleep(0.5)