Hello everyone,
I have an empty dictionary, options = {} , and I am appending various widgets like Select, TextInput etc. in the dictionary and then showing the same in the UI.
I want to find the name of the widget that the user is clicking. How do I do that ?
Untested but something along the lines of.
import panel as pn
pn.extension()
def callback(event):
print(event.obj.name)
text_in = pn.widgets.TextInput()
text_in.param.watch(callback, "value")
text_in.servable()
Hey @ahuang11 for your reply,
but my issue is that I have hundreds of ‘TextInput’ widgets present in my application and I want to check which widget the user is editing without having to set ‘.watch’ for all of them('TextInput widgets).
Is there a way I can listen to my mouse/cursor and register the widget clicked by the user ?
Thank You
Perhaps you can put all the text input widgets in a list and then loop through?
Yes, I followed the same and it worked. Thank You.
2 Likes