Python 获取kivymd threelineiconitem中的文本
在发布这个问题之前,我进行了搜索,没有发现类似的问题,因为在标题中,我希望在每次单击时检索mdlist的文本。我尝试了各种各样的方法,但一无所获。这是我的密码: 千伏 file.pyPython 获取kivymd threelineiconitem中的文本,python,kivymd,Python,Kivymd,在发布这个问题之前,我进行了搜索,没有发现类似的问题,因为在标题中,我希望在每次单击时检索mdlist的文本。我尝试了各种各样的方法,但一无所获。这是我的密码: 千伏 file.py def data(self,widget,text,search=False): self.connection() result=self.c.execute("SELECT matricule,nom,classe FROM etudiant") def add_ic
def data(self,widget,text,search=False):
self.connection()
result=self.c.execute("SELECT matricule,nom,classe FROM etudiant")
def add_icon_item(name1,name2,name3):
widget.data.append(
{
"viewclass": "CustomOneLineIconListItem",
"icon": "account",
"text": name1,
"secondary_text":name2,
"tertiary_text":name3,
"callback": lambda x: x,
"on_release": print(x.text)
}
)
widget.data = []
for row in result:
if search:
if text in row[0] or text in row[1] or text in row[2]:
add_icon_item(row[1],row[0],row[2])
else:
add_icon_item(row[1],row[0],row[2])
self.conn.close()
def data(self,widget,text,search=False):
self.connection()
result=self.c.execute("SELECT matricule,nom,classe FROM etudiant")
def add_icon_item(name1,name2,name3):
widget.data.append(
{
"viewclass": "CustomOneLineIconListItem",
"icon": "account",
"text": name1,
"secondary_text":name2,
"tertiary_text":name3,
"callback": lambda x: x,
"on_release": print(x.text)
}
)
widget.data = []
for row in result:
if search:
if text in row[0] or text in row[1] or text in row[2]:
add_icon_item(row[1],row[0],row[2])
else:
add_icon_item(row[1],row[0],row[2])
self.conn.close()