def start(): interface.start.init() font1 = Font("Courier New", 20, True, True) text = get_text().replace("\n", " ") y = TextBox([0.1, 0.1, 0.9, 0.9]) # for line in text_from_html(text).split("\n"): # y.text_wrap.add_text([Text(line, font1, new_line=True)]) y.text_wrap.add_text([Text(text, font1, new_line=True)]) while interface.start.get_running(): sleep(0.01)
"""Wrap a blank input box. Must be ran from root of project. """ from time import sleep from interface.display import InputBox, Font, Text import interface.start interface.start.init() font1 = Font("Courier New", 20, True, True) x = InputBox([.1, .1, .9, .9]) x.text_wrap.add_text([Text("", font1)]) while interface.start.get_running(): sleep(.01)
"""Wrap and display random chars. Must be ran from root of project. """ from time import sleep import string import random import _thread from interface.display import TextBox, Text, Font import interface.start interface.start.init() font1 = Font("Courier New", 50, True) x = TextBox([0.1, 0.1, 0.45, 0.9]) y = TextBox([0.55, 0.1, 0.9, 0.9]) def add_text(): color = tuple(random.randint(0, 255) for _ in range(0, 3)) text = ("".join( random.choice(string.printable + string.ascii_letters * 3) for i in range(0, random.randint(1, 100)))).replace("\n", "") x.text_wrap.add_text([Text(char, font1, highlight=color) for char in text]) y.text_wrap.add_text([Text(text, font1, highlight=color)]) while interface.start.get_running(): add_text()
"""Wrap random text with random fonts. Must be ran from root of project. """ from time import sleep import random import string from interface.display import TextBox, Text, Font import interface.start interface.start.init() font1 = Font("Courier New", 20, True, True) y = TextBox([.1, .1, .9, .9]) while interface.start.get_running(): for i in range(0, random.randint(1, 1000)): color = tuple(random.randint(0, 255) for _ in range(0, 3)) text = ("".join( random.choice(string.printable) for i in range(0, random.randint(1, 50)))) font2 = font1.edit(size=random.randint(1, 40)) y.text_wrap.add_text([Text(text, font2, highlight=color)]) sleep(.001) y.text_wrap.clear_all_text()