Attaching a "on" handler dynamically to widget #6175
Replies: 2 comments 3 replies
-
The short answer is "no". The closest that Textual supports is the However, this sounds like an XY problem. There is almost certainly a better way to accomplish what you are trying to solve. Could you elaborate on the problem you are tackling? |
Beta Was this translation helpful? Give feedback.
-
Hello Lars, Thanks for your help too :) In fact, underlying problem as you could have understood is : can we handle events (key, mouse) on a widget if handlers not first set in its declaration ? But, as you both tell me, i think the only way is to subclass the concerned widget... (widget.message_signal is hard to place...) Best regards, Fred |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Is there a way to manually attach an handler (eg: on_key, on_mouse_down etc) to a given widget dynamically ?
eg :
The widget may have already registered handlers so may keep in this case and add mine.
Message Pump maybe ?
Thank you for any help.
Best regards,
Fred
Beta Was this translation helpful? Give feedback.
All reactions