Sublime Forum

Get index of show_quick_panel rather than redirect to another function

#1

For using show_quick_panel function I have read this,

sublime.active_window().show_quick_panel(
    items, chosed_func
)

When some item is selected by user, chosed_func will be called. But there is a way to get index of selected item without redirecting to another function?

index = sublime.active_window().show_quick_panel(items)
print(items[index])
0 Likes

#2

No, it’s as-is in the docs.

ST won’t stuck the your plugin there to wait the user’s input. And that’s why there is a callback.

0 Likes

#3

No problem, but How can I access the list on callback function? I would just have an index.

0 Likes

#4

Got it. By setting variable to class property…

0 Likes

#5
0 Likes