def showSelectDevice(self, relativeTo): dropdown = DropDown() # auto_width=False, width='140dp' devices = IOT.getDevices(data.credentials.groundid) for dev in devices: btn = Button(size_hint_y=None, height='32dp') btn.DeviceId = dev['id'] if dev['title']: btn.text = dev[ 'title'] # for old devices that didn't ahve a title yet. else: btn.text = dev['name'] btn.bind(on_release=lambda btn: self.selectDevice( btn.parent.parent, btn.DeviceId, btn.text)) dropdown.add_widget(btn) dropdown.open(relativeTo)