In my application, I have a list of apps,
apps = [ App("app1", "username1", "password1", "----"), App("app2", "username2", "password2", "----"), App("app3", "username3", "password3", "----"),]
(App() is simply a class that contains data for each app)
Later in the code, I loop over this array to create a label widget for each app.
appLabels = []for a in apps: lbl = ptg.Label(a.name) def left_mouse(): showEditForm(a) lbl.on_left_click = lambda _: left_mouse() appLabels.append(lbl)
However, when i click on any of the labels, it always calls showEditForm()
with app3. How can I create a unique event handler for each app that will call showEditForm()
with the right app?