> For the complete documentation index, see [llms.txt](https://otter-1.gitbook.io/pwnhyve/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://otter-1.gitbook.io/pwnhyve/plugin-documentation/creating-your-own-plugin/printing-to-the-display.md).

# Printing to the display

Due to the creative nature of me and a lot of other people, there's many functions to print to the display - but we'll be using just basic text.

Drawing text can be in a terminal way (just add text and the backend will manage text wrapping, coordinates, etc.) or in a low level, pick the coordinates where you want the text to appear way. We'll be using the easiest: the terminal way, in this example.

To start, create the terminal backend class.

```python
terminal = tpil.gui.screenConsole(tpil)
```

{% hint style="info" %}
Any ready-made UI functions will be accessible via the GUI sub-class. Unfortunately due to my stupidity you have to pass the `tpil` argument to the functions in said subclass. Oops.
{% endhint %}

And to write text to the terminal console,

```python
terminal.addText("hello world")
```

Our example should now look something like this:

<pre class="language-python"><code class="lang-python"><strong>from core.plugin import BasePwnhyvePlugin
</strong>
class PWNExample(BasePwnhyvePlugin):
    def myExample(tpil):
        terminal = tpil.gui.screenConsole(tpil)
        
        terminal.addText("hello world")
        
        return
</code></pre>

Now if you try this code, it should run without errors. But you can't read anything. This is because:

{% stepper %}
{% step %}

### The function immediately returns after drawing the text

There's nothing to wait for you to read the text after you wrote to the display, so it'll just immediately exit, clear, and go back to the menu.
{% endstep %}
{% endstepper %}

So we should wait for our user to press a key this time.

To wait for the user's input, we'd use `tpil.waitForKey()`.

Our code should look like this now:

<pre class="language-python"><code class="lang-python"><strong>from core.plugin import BasePwnhyvePlugin
</strong>
class PWNExample(BasePwnhyvePlugin):
    def myExample(tpil):
        terminal = tpil.gui.screenConsole(tpil)
        terminal.addText("hello world")
        
        tpil.waitForKey()
        
        return
</code></pre>

Running this code on the Pi should cause no errors, and should show "hello world" on the display. :tada:
