Python 关闭Kivy中的弹出窗口
我在Kivy中为弹出窗口内的一个按钮分配了一个关闭弹出窗口功能。最类似帖子中的解决方案不起作用: 以下是我的python代码:Python 关闭Kivy中的弹出窗口,python,kivy,Python,Kivy,我在Kivy中为弹出窗口内的一个按钮分配了一个关闭弹出窗口功能。最类似帖子中的解决方案不起作用: 以下是我的python代码: def display_list(self): show = ListPopup() self.popupWindow = Popup(title="Wortliste", content=show, size_hint=(None,N
def display_list(self):
show = ListPopup()
self.popupWindow = Popup(title="Wortliste",
content=show,
size_hint=(None,None),
size=(800,1600),
pos_hint={'right': 0.95, 'top': 1})
self.popupWindow.open()
def dismiss_list_popup(self):
self.popupWindow.dismiss()
class ListPopup(GridLayout):
def words_found(self):
if word_list == []:
return "Noch nichts gefunden"
else:
display_liste = "".join([word + "\n" for word in word_list])
return display_liste '''
这是kivy文件的相关部分:
<ListPopup>:
Button:
text: "Schließen"
id: popup_close
size_hint_y: 0.1
on_release: root.dismiss_list_popup() '''
所以问题是,kivy文件中的root是指ListPopup类,而不是我想忽略的弹出窗口“self”也不这样做,因为“self”指的是按钮
你能在这里帮我找到正确的参考资料吗?或者告诉我如何更好地解决这个问题?信息不足。请发一封信。
AttributeError: 'ListPopup' object has no attribute 'dismiss_list_popup'