Sublime Forum

How do I use this feature?


I don’t understand how to use the create_output_panel () function.
Please tell me how to create and display a panel using this function. If not difficult, please with a full example.



Try this in the console:

>>> panel = window.create_output_panel('Test')
>>> panel.run_command('insert', {'characters': 'I am the contents of the test panel'})
>>> window.run_command('show_panel', {'panel': 'output.Test'})

The method creates (or recreates) an output panel with the provided name and returns a view that represents the contents. You can do anything with the view that you can do with any other view, such as insert text, apply settings to set the syntax or turn off the gutter, etc.

To make the panel open, use the show_panel command; the panel is also available in the panel chooser menu automatically for the user to open as they wish.

1 Like


Thanks. And how do I create this panel on the right and not on the bottom?



Panels are currently constrained to being at the bottom of the window only.



And how do I use this in my plugin code?
Here is the sample code:
def run(self, edit):
panel = sublime.Window.create_output_panel(id, ‘Test’)
But nothing works. How to do it right?
What Id should I send?



If you’re using a TextCommand then you want self.view.window().create_output_panel() for a WindowCommand you would use self.window.create_output_panel(), and for an ApplicationCommand you would use sublime.active_window().create_output_panel().

That said, it sounds like you may want to get more familiar with the API in general.



I’m already embarrassed to ask you, but there are a lot of questions left. But how do I use the insert function to my panel in my plugin code?

1 Like


No need to be embarassed.

You can’t use the insert method unless you’re inside of a TextCommand. So, you would need to define one of those and then call it in the same way that the sample above is using run_command to run the built in insert command.


I guess iht patt e rigwill not take too long.
I guess it will be 
I guess it i