mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2025-01-12 12:28:13 +00:00
34 lines
595 B
Python
34 lines
595 B
Python
from contextlib import contextmanager
|
|
import sys
|
|
|
|
|
|
@contextmanager
|
|
def html():
|
|
sys.stdout.write('\x1bP;HTML|')
|
|
yield
|
|
sys.stdout.write('\x1bP')
|
|
sys.stdout.flush()
|
|
|
|
|
|
@contextmanager
|
|
def image(mime='image'):
|
|
sys.stdout.write('\x1bP;IMAGE|%s;' % mime)
|
|
yield
|
|
sys.stdout.write('\x1bP\n')
|
|
sys.stdout.flush()
|
|
|
|
|
|
@contextmanager
|
|
def prompt():
|
|
sys.stdout.write('\x1bP;PROMPT|')
|
|
yield
|
|
sys.stdout.write('\x1bP')
|
|
sys.stdout.flush()
|
|
|
|
|
|
@contextmanager
|
|
def text():
|
|
sys.stdout.write('\x1bP;TEXT|')
|
|
yield
|
|
sys.stdout.write('\x1bP')
|
|
sys.stdout.flush()
|