How to make a Sublime Text 2 plugin with a custom display area at the bottom, like the console?

sublimetext, sublimetext2

Solution

Basically, what you need is

- Create an output panel: `self.window.get_output_panel("textarea")`

- Show this panel: `self.window.run_command("show_panel", {"panel": "output.textarea"})`

A simple example is shown below. And you can refer to exec command in the default package: `C:\Users\lhuang\AppData\Roaming\Sublime Text 2\Packages\Default\exec.py`.

class ShowTextAreaCommand(sublime_plugin.WindowCommand):
    def run(self):
        self.output_view = self.window.get_output_panel("textarea")
        self.window.run_command("show_panel", {"panel": "output.textarea"})

        self.output_view.set_read_only(False)
        edit = self.output_view.begin_edit()
        self.output_view.insert(edit, self.output_view.size(), "Hello, World!")
        self.output_view.end_edit(edit)
        self.output_view.set_read_only(True)

Problem

I wish to make a Sublime Text 2 plugin which will display information in an area at the bottom of the screen, just like the console does. However in this area I wish to display my own text from my Plugin, not related to the console. Here is a screenshot of a window with the console open. How can this be done?

Original source