from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.uix.gridlayout import GridLayout from kivy.uix.label import Label from kivy.uix.textinput import TextInput from kivy.lang import Builder import asyncio from bleak import BleakClient,BleakScanner # import json STM32_UUID = "00001101-0000-1000-8000-00805F9B34FB" class InfoWidget(Widget): # def __init__(self, **kwargs): # super(InfoWidget, self).__init__(**kwargs) async def discover_devices(self): self.size = (800,480) devices = await BleakScanner.discover() grid00 = GridLayout(cols=1,rows=2,width=self.width,height=self.height / 4) grid00.top = self.top self.add_widget(grid00) grid01 = GridLayout(cols=2,rows=1,width=grid00.width,height=grid00.height / 2) grid00.add_widget(grid01) grid01.add_widget(Label(text="Device Name:",width=grid00.width / 2,height=grid00.height / 2,font_size=50)) deviceName = "HC-06" grid01.add_widget(TextInput(text=deviceName,width=grid00.width / 2,height=grid00.height / 2,font_size=40)) connect_button = Button(text="Connect",width=grid00.width,height=grid00.height / 2,center_x=grid00.center_x,font_size=40) Builder.load_string('''