Ejemplo n.º 1
0
    def __init__(self):
        """Constructor"""

        threading.Thread.__init__(self) # Parent class constructor

        # GPIO setup
        self.unlock_pin = gpiozero.LED(TwiddleLock.unlock_pin)
        self.lock_pin = gpiozero.LED(TwiddleLock.lock_pin)
        self.service_btn = gpiozero.Button(TwiddleLock.service_btn_pin, bounce_time = 0.2, hold_time = 3)
        self.buzzer = gpiozero.Buzzer(TwiddleLock.buzzer_pin)

        # Potentiometer setup
        self.adc = Adafruit_MCP3008.MCP3008(mosi = TwiddleLock.spi_mosi_pin, miso = TwiddleLock.spi_miso_pin, clk = TwiddleLock.spi_clk_pin, cs = TwiddleLock.spi_ss_pin)
        self.potentiometer = Potentiometer(self.adc, TwiddleLock.adc_pot_channel)
        self.potentiometer.start()

        # LCD screen setup
        self.lcd = RPI_LCD.LCD(18, 17, 27, 22, 23, 24)

        # Variable setup
        self.log = []
        self.dir = []
        self.service_btn_held_last = False
        self.locked = True
        self.secure = True
        self.combo_in_progress = False
        self.to_close = False

        self.correct_combo = Combination([10, 20, 10], [-1, 1, -1])
Ejemplo n.º 2
0
    def load_configuration(self, configuration):
        config = configparser.ConfigParser()
        config.read(configuration)

        self.distance = int(config["DEFAULT"]["distance"])

        self.GREEN_LED = gpiozero.LED(int(config["GPIO"]["light_green"]),
                                      active_high=False,
                                      initial_value=True)
        self.RED_LED = gpiozero.LED(int(config["GPIO"]["light_red"]),
                                    active_high=False)

        self.TOP = gpiozero.Button(int(config["GPIO"]["sensor_top"]),
                                   pull_up=True,
                                   active_state=None)
        self.BOTTOM = gpiozero.Button(int(config["GPIO"]["sensor_bottom"]),
                                      pull_up=True,
                                      active_state=None)

        self.MAX_TIME = int(config["TIMING"]["auto_reset_time"])
        self.MIN_TIME = int(config["TIMING"]["ignore_time"])

        self.mqtt_server = str(config["SERVER"]["mqtt"])
        self.name = config["DEFAULT"]["name"]
        self.rider = Rider()
        self.status = Mode

        print("[Info]: Loaded configuration: " + self.name)

        return
 def __init__(self):
     defaultCorretion = 0.45
     maxPW=(2.0+defaultCorretion)/1000
     minPW=(1.0-defaultCorretion)/1000
     self.servo1 = GZ.Servo(self.__servo1Pin, min_pulse_width=minPW, max_pulse_width=maxPW, frame_width = 20/1000)
     self.servo2 = GZ.Servo(self.__servo2Pin, min_pulse_width=minPW, max_pulse_width=maxPW, frame_width = 20/1000)
     
     print ("Waiting for servo start")
     self.servo1.value = -1
     time.sleep(0.5)
     self.servo2.value = 1
     time.sleep(0.5)
     self.servo1.detach()
     self.servo2.detach()
     self.led1 = GZ.LED(self.__led1Pin)
     self.led2 = GZ.LED(self.__led2Pin)
     self.switchModeLed = GZ.LED(self.__switchModeLedPin)
     self.button1 = GZ.Button(self.__button1Pin, pull_up = True)
     self.button2 = GZ.Button(self.__button2Pin, pull_up = True)
     self.pSensor = GZ.Button(self.__pSensorPin)
     self.button1.when_pressed = self.pressButton1
     self.button2.when_pressed = self.pressButton2
     self.pSensor.when_pressed = self.detectObject
     # init stepper motor
     stepperMotor_pins = (14, 15, 18)
     direction = 20      
     step = 21
     self.stepperMotor = RpiMotorLib.A4988Nema(direction, step, stepperMotor_pins, "A4988")
Ejemplo n.º 4
0
    def __init__(self, clv):
        global MySelf
        # ----------------------------------------------------------------------
        # Activate leds, if we are on Raspberry
        # ----------------------------------------------------------------------
        self.OK = UseLeds
        MySelf = self

        # ----------------------------------------------------------------------
        # Activate leds, if -L defined
        # Reason for -L is that usage of GPIO might be conflicting with other
        #       applications on the Raspberry
        # ----------------------------------------------------------------------
        if self.OK and clv != None:
            self.OK = clv.rpiLeds

        # ----------------------------------------------------------------------
        # Create 5 leds on these Pins as outputs.
        # The numbers are the numbers of the IO-Pins of the Raspi
        # Don't forget to add the series resistor of 470 Ohm
        # ----------------------------------------------------------------------
        if self.OK:
            self.LedTacx = gpiozero.LED(5)  # Orange
            self.LedShutdown = gpiozero.LED(6)  # Red
            self.LedCadence = gpiozero.LED(13)  # White
            self.LedBLE = gpiozero.LED(19)  # Blue
            self.LedANT = gpiozero.LED(26)  # Green

            self.BtnShutdown = gpiozero.Button(3)

        # ----------------------------------------------------------------------
        # Show leds for power-up
        # ----------------------------------------------------------------------
        if self.OK:
            self.PowerupTest()
Ejemplo n.º 5
0
def initialise():
    # I happen to have the following coloured wires attached
    # to my PCB, and wire them to the Pi in the following order
    #
    # Orange   Vdd   3.3V
    # Yellow    NC      -
    # Green   Vled     5V
    # Blue     GND    GND
    #
    # Purple   CLK   GPIO 14
    # Grey     SDI   GPIO 15
    # White     LE   GPIO 18
    # Black     OE   GPIO 23
    #

    controls = {}
    controls["lock"] = threading.Lock()
    controls["CLK"] = gpiozero.LED(14)
    controls["SDI"] = gpiozero.LED(15)
    controls["LE"] = gpiozero.LED(18)
    controls["OE"] = gpiozero.LED(23)

    # OE is active low, so turn on to disable all lights to start with.
    controls["OE"].on()

    return controls
Ejemplo n.º 6
0
    def init_inprogress(self):
        self.switch = gpio.Button(26)
        self.switch.when_pressed = self.run_dif
        self.led_r = gpio.LED(5)
        self.led_g = gpio.LED(6)
        self.led_flash = gpio.LED(19)

        self.label_prog = ttk.Label(self.frame_inprogress,
                                    text='Analyzing',
                                    font='-weight bold -size 20')
        self.label_img = ttk.Label(self.frame_inprogress)
        self.button_back = ttk.Button(self.frame_inprogress,
                                      text='Back',
                                      command=self.inprogress2main)
        self.pb_dif = ttk.Progressbar(self.frame_inprogress,
                                      orient='horizontal',
                                      mode='indeterminate',
                                      length=400)

        self.label_prog.grid(row=1, column=1)
        self.label_img.grid(row=2, column=1)
        self.pb_dif.grid(row=3, column=1)
        self.button_back.grid(row=4, column=1)

        self.frame_inprogress.rowconfigure(0, weight=1)
        self.frame_inprogress.rowconfigure(5, weight=1)
        self.frame_inprogress.columnconfigure(0, weight=1)
        self.frame_inprogress.columnconfigure(2, weight=1)
Ejemplo n.º 7
0
    def __init__ (self, state_file = None ):
        if state_file is None:
            state_file = STATE_FILE
        self.statefile = state_file
        self.reverse_of = { 'CLOSING': self.open, 'CLOSED': self.open, 
            'OPENING':self.close, 'OPEN': self.close }
        
        self.button = gpiozero.Button(BUTTON)
        self.pressure_sensor = gpiozero.Button(PRESSURE)
        self.open_led = gpiozero.LED(LED_O)
        self.close_led = gpiozero.LED(LED_C)
        self.open_relay = gpiozero.OutputDevice(RELAY_O)
        self.close_relay = gpiozero.OutputDevice(RELAY_C)

        self.led_of = {'OPENING': self.open_led, 'OPEN': self.open_led,
                'CLOSING': self.close_led, 'CLOSED': self.close_led }

        self.button.when_pressed = self.press_button
        self.pressure_sensor.when_pressed = self.sense_pressure
        
        try:
            handle = open(self.statefile)
            self.set_state(handle.read().rstrip())
            print(f"*** State File Says {self.state} ***")
            handle.close()
        except IOError:
            print(f"Failed to open state file {self.statefile}")
Ejemplo n.º 8
0
def main():
    load1 = gpiozero.LED(20, active_high=False)
    load2 = gpiozero.LED(21, active_high=False)
    load1.on()
    load2.on()
    time.sleep(10)
    load1.off()
    load2.off()
Ejemplo n.º 9
0
 def __init__(self):
     self.state = "PARKED"
     self.parked_led = gpiozero.LED(GPIO_PIN_OUT_PARKED_LED)
     self.shooting_led = gpiozero.LED(GPIO_PIN_OUT_SHOOTING_LED)
     self.state_button = gpiozero.Button(GPIO_PIN_IN_STATE_BUTTON, pull_up=False, hold_time=3)
     self.state_button.when_pressed = self.toggle_state
     self.state_button.when_held = self.shutdown
     self.enter_parked()
Ejemplo n.º 10
0
Archivo: leds.py Proyecto: fisherds/RPi
def basic_led_on():
    red_led = gz.LED(14)
    yellow_led = gz.LED(15)
    green_led = gz.LED(18)

    red_led.on()
    yellow_led.on()
    green_led.on()
    time.sleep(3)
    print("Goodbye")
 def __init__(self, red_pin, green_pin, blue_pin):
     #self.red = gpiozero.PWMLED(red_pin, frequency=80, initial_value=1)
     #self.green = gpiozero.PWMLED(green_pin, frequency=80, initial_value=1)
     #self.blue = gpiozero.PWMLED(blue_pin, frequency=80, initial_value=1)
     """ unfortunately the PWM on the rpi can't be stable enough
         so it flickers too much. That's why I use digital IO instead """
     self.red = gpiozero.LED(red_pin)
     self.green = gpiozero.LED(green_pin)
     self.blue = gpiozero.LED(blue_pin)
     self.leds = [self.red, self.green, self.blue]
     self.off()
Ejemplo n.º 12
0
def fancy_blink():
    red_led = gz.LED(14)
    yellow_led = gz.LED(15)
    green_led = gz.LED(18)

    red_led.blink()
    time.sleep(0.5)
    yellow_led.blink()
    time.sleep(0.5)
    green_led.blink()

    signal.pause()
Ejemplo n.º 13
0
    def __init__(self):
        self.state = DoorStateEnum.HALF_OPENED
        self.threeWayActivatorThread = ThreeWayActivatorThread(
            gpiozero.LED(active_high=False, pin=MOTOR_ACTIVATOR_PIN))
        self.threeWayActivatorThread.start()

        self.internalControlButton = gpiozero.Button(pin=4, pull_up=False)
        self.internalControlButton.when_pressed = self.activate

        self.door_locker = gpiozero.LED(pin=21,
                                        active_high=False,
                                        initial_value=True)
    def __init__(self,
                 step,
                 direction,
                 ms1,
                 ms2,
                 ms3,
                 enable,
                 microstepping=1,
                 rpm=1,
                 steps_per_rev=200,
                 Kp=0.2,
                 Ki=0.1):

        #Assign GPIO for the big easy driver
        self.dir = gpiozero.LED(direction)
        self.ms1 = gpiozero.LED(ms1)
        self.ms2 = gpiozero.LED(ms2)
        self.ms3 = gpiozero.LED(ms3)
        self.en = gpiozero.LED(enable)

        #assign the queue
        self.queue = mp.Queue()

        #Set motor speed
        self.rpm = rpm
        self.spr = steps_per_rev
        self.Kp = Kp
        self.Ki = Ki
        self.microstepping = microstepping

        #Set initial pin conditions
        self.set_microstep(self.microstepping)
        self.en.on()
        self.dir.off()

        #Start the motor in the next process
        args = (
            step,
            self.queue,
            self.rpm,
            self.microstepping,
            self.spr,
            self.Kp,
            self.Ki,
        )

        try:
            p1 = mp.Process(target=self.turn, args=args)
            p1.start()

        except Exception as e:
            logging.error(e)
Ejemplo n.º 15
0
    def _setup_hardware(self):
        """ Create instances of all peripherals needed. """

        self._red_LED = gpiozero.LED(12)
        self._green_LED = gpiozero.LED(13)
        self._blue_LED = gpiozero.LED(19)

        self._button = gpiozero.Button(4,
                                       hold_time=3,
                                       hold_repeat=False,
                                       pull_up=True)
        self._button.when_pressed = self._on_button_press
        self._button.when_released = self._on_button_release
        self._button.when_held = self._on_button_hold
Ejemplo n.º 16
0
def setupSpi():
    global dataControlPin
    global resetPin
    global chipSelectPin
    global spiDevice

    dataControlPin = gpiozero.LED(DC_GPIO)
    resetPin = gpiozero.LED(RES_GPIO)
    chipSelectPin = gpiozero.LED(CS_GPIO)

    spiDevice = spidev.SpiDev(0, 0)
    spiDevice.mode = 3
    spiDevice.lsbfirst = False
    spiDevice.max_speed_hz = SPI_SPEED_HZ
Ejemplo n.º 17
0
    def __init__(self,
                 leftOn=17,
                 leftDir=27,
                 rightOn=23,
                 rightDir=24,
                 modePin=22):
        # Motor Stuff
        self.leftMotor = gpiozero.PWMLED(leftOn, frequency=50)
        self.leftDir = gpiozero.LED(leftDir)

        self.rightMotor = gpiozero.PWMLED(rightOn, frequency=50)
        self.rightDir = gpiozero.LED(rightDir)

        self.mode = gpiozero.LED(modePin)
        self.mode.on()
Ejemplo n.º 18
0
Archivo: leds.py Proyecto: fisherds/RPi
def manual_blink():
    red_led = gz.LED(14)
    yellow_led = gz.LED(15)
    green_led = gz.LED(18)

    # for k in range(5):
    while True:
        red_led.on()
        yellow_led.on()
        green_led.on()
        time.sleep(1)
        red_led.off()
        yellow_led.off()
        green_led.off()
        time.sleep(1)
Ejemplo n.º 19
0
 def __init__(self):
     self.mashtun = devices.JamMaker(0, 27, self.mash_temp_reached)
     self.boiler = devices.JamMaker(1, 22, self.boil_temp_reached)
     self.mashpump = gpiozero.LED(2)
     self.temppump = gpiozero.LED(3)
     self.boilpump = gpiozero.LED(4)
     self.mashvalve = devices.TwoWayValve(14, 15, "mash", "temp", 2)
     self.boilvalve = devices.TwoWayValve(17, 18, "mash", "boil", 2)
     testrecipe = recipes.Recipe(mash_stages=[(50, 1), (64, 1), (68, 1),
                                              (74, 1)],
                                 boiling_time=1,
                                 mash_water=1,
                                 sparge_water=1)
     self.process = process.BrewProcess(testrecipe, self)
     threading.Timer(5, self.print_status).start()
Ejemplo n.º 20
0
    def __init__(self):
        self.__logger = logging.getLogger(__name__)
        self.__logger.info("VibraAnnouncer.__init__() called")
        super(VibraAnnouncer, self).__init__()

        # Output-GPIO zuordnen
        self.__vm_left_front  = io.LED(5)  # GPIO 5 für VM left front
        self.__vm_left_back   = io.LED(12) # GPIO 5 für VM left back
        self.__vm_middle      = io.LED(6)  # GPIO 6 für VM middle
        self.__vm_right_front = io.LED(13) # GPIO 13 für VM right front
        self.__vm_right_back  = io.LED(16) # GPIO 16 für VM right back

        self.__impulsdauer = config.vibration['impulsdauer']
        self.__nachpause   = config.vibration['nachpause']
        self.__signalpause = config.vibration['signalpause']
Ejemplo n.º 21
0
def pinMode(pin, mode):
    assert pin >= 0 and pin < 28
    assert mode == 1 or mode == 0
    if mode == 1:
        pins[pin] = gpiozero.Button(pin)
    else:
        pins[pin] = gpiozero.LED(pin)
Ejemplo n.º 22
0
    def register(self):
        try:
            self.__logger.debug("Regestriere Raspberry GPIO...")
            from gpiozero.pins.native import NativeFactory
            from gpiozero import Device

            Device.pin_factory = NativeFactory()
            self.__logger.debug("InputPin = %s", self._config["rpiDoor/openedPin"])
            self.input = gpiozero.Button(pin=self._config["rpiDoor/openedPin"])
            self.__logger.debug("OuputPin = %s", self._config["rpiDoor/unlockPin"])
            self.out   = gpiozero.LED(   pin=self._config["rpiDoor/unlockPin"])

            self.input.when_activated   = lambda: self.InputHandler(True )
            self.input.when_deactivated = lambda: self.InputHandler(False)

            schedule.every(15).minutes.do(self.sendUpdate)

            self.__logger.debug("Regestiere MQTT Topics")
            unique_id = "sensor.doorOpener-{}.{}".format(self._device_id, self._config["rpiDoor/name"].replace(" ", "_"))
            self.topic = self._config.get_autodiscovery_topic(conf.autodisc.Component.SWITCH, self._config["rpiDoor/name"], None)
            payload = self.topic.get_config_payload(self._config["rpiDoor/name"], None, unique_id=unique_id,
                            json_attributes=True, value_template="{{ value_json.sw }}")
            self.__client.publish(self.topic.config, payload=payload, qos=0, retain=True)

            self.__client.message_callback_add(self.topic.command, self.on_message)
            self._registered_callback_topics.append(self.topic.command)
            self.__client.subscribe(self.topic.command)
            self.sendUpdate()
        except Exception as e:
            self.__logger.exception("Register hat fehler verursacht!")
            raise e
Ejemplo n.º 23
0
 def __init__(self, pinNumber):
     self.updateQueue = queue.Queue(maxsize=0)
     self.isLedOn = False
     self.currentTimeInMs = int(time.time() * 1000)
     self.lastTimeMark = 0
     self.upcomingToggleMark = self.NO_PENDING_TOGGLE_MARK
     self.led = gpiozero.LED(pinNumber)
Ejemplo n.º 24
0
    def __init__(self, eventCallback, config):
        debounce = 0.01
        self.eventCallback = eventCallback
        self.config = config
        self.buttons = {}
        # create gpio button objects for each button and register callbacks for them
        for pin in set(self.config.pinButtonMap) | set(
                self.config.pinSwitchLowMap) | set(
                    self.config.pinSwitchHighMap):
            thisbutton = gpiozero.Button(pin,
                                         bounce_time=debounce,
                                         hold_time=self.config.repeatFirst /
                                         1000)
            if pin in self.config.pinButtonMap:
                thisbutton.hold_repeat = self.config.repeatDelay / 1000
                thisbutton.when_held = self.pressCallback
                if pin in self.config.pinSwitchHighMap:
                    thisbutton.when_pressed = self.downPressCallback
                else:
                    thisbutton.when_pressed = self.pressCallback
            elif pin in self.config.pinSwitchHighMap:
                thisbutton.when_pressed = self.downCallback
            if pin in self.config.pinSwitchLowMap:
                thisbutton.when_released = self.upCallback
            self.buttons[pin] = thisbutton

        self.rxGoodLED = None
        # create a gpio LED object for the status light if there is a pin defined
        if self.config.rxGoodPin is not None:
            self.rxGoodLED = gpiozero.LED(self.config.rxGoodPin)

        # socket to notify the main loop of a button press
        self.recvSock, self.sendSock = socket.socketpair()
        # thread save queue to store the actual events
        self.eventQueue = queue.Queue()
Ejemplo n.º 25
0
 def __init__(self, name, gpiopin, blynk_vpin, on_value, min_pause, *args,
              **kwargs):
     self.name = name
     self.gpiopin = gpiopin
     self.vpin = blynk_vpin
     self.on_value = on_value
     try:
         self.gpio_obj = gpiozero.LED(gpiopin)
     except gpiozero.exc.GPIOPinInUse:
         raise gpiozero.exc.GPIOPinInUse
     self.min_pause = min_pause
     try:
         with open("settings/last_turned_on.json") as file_settings:
             last_turned_on = dict(json.load(file_settings))
     except FileNotFoundError:
         last_turned_on = dict()
         last_turned_on[name] = str(datetime.datetime.today() +
                                    datetime.timedelta(days=-1))
         with open('settings/last_turned_on.json', 'w') as outfile:
             json.dump(last_turned_on, outfile)
     if name not in last_turned_on.keys():
         last_turned_on[name] = str(datetime.datetime.today() +
                                    datetime.timedelta(days=-1))
         with open('settings/last_turned_on.json', 'w') as outfile:
             json.dump(last_turned_on, outfile)
     self.last_date_turned_on = datetime.datetime.strptime(
         last_turned_on[name], "%Y-%m-%d %H:%M:%S.%f")
Ejemplo n.º 26
0
 def initPin(self, pin):
   if pin == self.pin:
     logging.warning('Cannot init a PIN which is in-use')
     return
   t = gpiozero.LED(pin, active_high=False)
   t.off()
   t.close()
Ejemplo n.º 27
0
        def setup_cb(pin,mode):
            #print("pin=%d,status=%d" %(pin,)
            # do gpio setup 
            if mode == "out":
                try:
                    led = GPIO.LED(pin)
                    self.add_digital_hw_pin(pin, None, gpioOut_h, led)
                    logging.getLogger().debug(str(pin)+ str(mode))
                
                except:
                    pass
            if mode == "in":
                print(pull)
                if pull=="up":
                    button = GPIO.DigitalInputDevice(pin, pullup=True) 
                elif pull=="down":
                    button = GPIO.DigitalInputDevice(pin, pullup=False) 
                elif pull=="button":
                    button = GPIO.Button(pin) 
                else:
                    button = GPIO.InputDevice(pin) 

                self.add_digital_hw_pin(pin, gpioRead_h, None, button)  
                # note the gpiozero button / led objects are payload as "state"
                logging.getLogger().debug(str(pin)+ str(mode))
Ejemplo n.º 28
0
Archivo: leds.py Proyecto: fisherds/RPi
def manual_traffic_light():
    red_led = gz.LED(14)
    yellow_led = gz.LED(15)
    green_led = gz.LED(18)

    # Loop forever, green for 5, yellow for 1, red for 3
    while True:
        green_led.on()
        time.sleep(5)
        green_led.off()
        yellow_led.on()
        time.sleep(1)
        yellow_led.off()
        red_led.on()
        time.sleep(3)
        red_led.off()
Ejemplo n.º 29
0
def _main():
	logging.basicConfig(handlers=[RotatingFileHandler(LOG_PATH, maxBytes=100000, backupCount=1)], format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s', datefmt='%Y-%m-%dT%H:%M:%S', level=logging.INFO)

	led = gpio.LED(47, active_high=False)
	nClients = numberOfSSHOpen(FILE_PATH)
	updateLed(led, nClients)

	i = inotify.adapters.Inotify()
	mask = inotify.constants.IN_CREATE | inotify.constants.IN_MODIFY | inotify.constants.IN_DELETE | inotify.constants.IN_DELETE_SELF | inotify.constants.IN_MOVED_FROM | inotify.constants.IN_MOVED_TO
	i.add_watch(FILE_PATH, mask)

	for event in i.event_gen(yield_nones=False):
		if 'IN_MODIFY' in event[1]:
			logging.debug("File was modified")
			n = numberOfSSHOpen(FILE_PATH)
			if n != nClients:
				updateLed(led, n)
			nClients = n
			logging.info("There are %d clients conected" % n)

		elif 'IN_DELETE' in event[1]:
			logging.critical("File was delete!!!")
			led.blink(0.1, 0.1, 20)
			led.on()
			sys.exit(0)

		else:
			(_, type_names, path, filename) = event
			logging.debug("PATH=[{}] FILENAME=[{}] EVENT_TYPES={}".format(path, filename, type_names))
Ejemplo n.º 30
0
def main():
    led = gpiozero.LED(17)
    led.on()  # light when app is running

    active_buzzer = gpiozero.Buzzer(20)

    button1 = gpiozero.Button(26)
    button2 = gpiozero.Button(19)
    button3 = gpiozero.Button(13)
    button4 = gpiozero.Button(6)
    button5 = gpiozero.Button(5)
    button6 = gpiozero.Button(22)
    button7 = gpiozero.Button(27)

    button1.when_pressed = active_buzzer.toggle
    button2.when_pressed = active_buzzer.on
    button3.when_pressed = active_buzzer.off
    button4.when_pressed = active_buzzer.beep
    button5.when_pressed = lambda: active_buzzer.beep(0.1, 0.1, 1)
    button6.when_pressed = lambda: active_buzzer.beep(0.3, 0.1, 1)

    running = True

    def close():
        nonlocal running
        print("closing...")
        running = False

    button7.when_pressed = close

    while running:
        pass