По какой-то причине мой выпадающий список kivy не отображается, и я следую точному методу из документации. Все еще безрезультатно. Я ценю любую помощь. Вот мой код.
class NewProjectScreen(Screen):
def __init__(self, **kwargs):
super(NewProjectScreen, self).__init__(**kwargs)
self.location = TextInput(multiline = True, pos_hint = {"center_x": 0.5, "center_y": 0.6}, hint_text = "Location", size_hint = [0.4, 0.10], font_name = 'fonts/Qanelas-Light.otf', id = "location")
self.add_widget(self.location)
self.location.bind(text = self.dropdown)
def dropdown(self, instance, value):
if len(self.location.text) > 0:
towns_cities = 'https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=' + self.location.text + "&inputtype=textquery&fields&types=geocode&sensor=false&types=regions&key=" + API_KEY
response = urllib.request.urlopen(towns_cities).read()
directions = json.loads(response)
print(directions)
for places in directions:
place = places
self.dropdown = DropDown()
for index in range (5):
btn = Button(text = places[index])
self.dropdown.add_widget(btn)
btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
self.dropdown.open(btn)