vanilla
vanilla copied to clipboard
Request: unified way to add tooltips
Right now, I need to access the NS object and call its setToolTip: function. The problem is that the object getter is syntactically different for each vanilla object:
self.w.myTextField.getNSTextField().setToolTip_("Tooltip text.")
self.w.myPopupButton.getNSPopUpButton().setToolTip_("Tooltip text.")
How about something like this instead:
self.w.myTextField.tooltip("Tooltip text.")
self.w.myPopupButton.tooltip("Tooltip text.")
Or am I overthinking the issue?
Yes, but: self.myTextField.setToolTip("...").
Both NSView and NSControl support the setToolTip_ method, so adding setToolTip to VanillaBaseObject would cover a lot of cases.
Would you like to make a PR?
hi Just :) , just added PR. I hope it looks ok
Thanks @RafalBuchner!
import vanilla
w = vanilla.Window((200, 40))
w.b = vanilla.Button((10, 10, -10, 20), "Hover Over Me")
w.b.setToolTip("Thanks @RafalBuchner :)")
w.open()