Closed asztalosdani closed 1 year ago
I'll review this asap
I ran into this a bit ago too. _onbeforeopen is called in menu.py line 3190, and after return the first widget is selected. I was planning to reverse those if I couldn't find any other way to make my change stick.
I can confirm, after commenting the self._current._select(0, 1, SELECT_OPEN, False, update_mouse_position=False)
my example code works as expected. If I don't call select_widget()
in the onbeforeopen
callback the first is selected even without the call. Can it be removed completely, or should it be just moved above the callback invocation?
Fixed in #448. Let me know if this solves your issue 😄
That change works perfectly for what I was doing. Thanks!
Yes, it works like a charm! 🎉
Version v4.3.7
uploaded to pip!
Environment information Describe your environment information, such as:
Describe the bug I have a submenu, and in the
onbeforeopen
callback, I want to select a specific item. Callingmenu.select_widget()
does not do anything, always the first item is selected.To Reproduce
Expected behavior Option 2 should be selected.
Additional context I tried passing
button_id
and the widget instance without luck.