Sublime Forum

Displaying more information in a show_quick_panel

#1

How does PC show more information per item ? How can I do that in a show_quick_panel ?
image

0 Likes

#2

The items that you pass to show_quick_panel() can either be a list of strings or a list of lists.

When you give it a list of strings, each string in the list becomes an entry in the quick panel so you end up with one entry per line:

window.show_quick_panel(["First", "Second", "Third"], None)

You can also pass a list of list of strings instead, in which case each entry in the outer list still represents one row, but the number of items in the row is now controlled by the number of items in the lists:

window.show_quick_panel([["First", "A"], ["Second", "B"]], None)

Sublime takes care to render the lines as in your screenshot (i.e. the first line has a larger font and a different color than subsequent lines).

Note that if you do this, all of the lists you pass need to have the same length; something like the following will not work:

window.show_quick_panel([["First", "A"], ["Second"]], None)

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/tmartin/local/sublime_text_4060/Lib/python38/sublime.py", line 512, in show_quick_panel
    flat_items.append(items[i][j])
IndexError: list index out of range
0 Likes