示例#1
0
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)])
示例#2
0
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)
示例#3
0
"""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)
示例#4
0
import interface.start

interface.start.init()

font1 = Font("Courier New", 20, True, True)

text = """
For all its material advantages, the sedentary life has left us edgy, unfulfilled. Even after 400 generations in villages and cities, we haven’t forgotten. The open road still softly calls, like a nearly forgotten song of childhood. We invest far-off places with a certain romance. This appeal, I suspect, has been meticulously crafted by natural selection as an essential element in our survival. Long summers, mild winters, rich harvests, plentiful game—none of them lasts forever. It is beyond our powers to predict the future. Catastrophic events have a way of sneaking up on us, of catching us unaware. Your own life, or your band’s, or even your species’ might be owed to a restless few—drawn, by a craving they can hardly articulate or understand, to undiscovered lands and new worlds.

Herman Melville, in Moby Dick, spoke for wanderers in all epochs and meridians: “I am tormented with an everlasting itch for things remote. I love to sail forbidden seas…”

Maybe it’s a little early. Maybe the time is not quite yet. But those other worlds— promising untold opportunities—beckon.

Silently, they orbit the Sun, waiting.
"""

x = InputBox([.1, .1, .45, .9])
y = InputBox([.55, .1, .9, .9])

string = ""
for i, char in enumerate(text):
    string += char
    if not i % 40 or i == len(text) - 1:
        color = tuple(random.randint(0, 255) for _ in range(0, 3))
        x.text_wrap.add_text([Text(string, font1, highlight=color, new_line=True)])
        y.text_wrap.add_text([Text(string, font1, highlight=color)])
        string = ""

while interface.start.get_running():
    sleep(.01)
示例#5
0
import random
import _thread

from interface.display import TextBox, Text, Font
import interface.start

from wrap_tests.block import get_text

interface.start.init()

font1 = Font("Courier New", 20, True, True)

y = TextBox([0.1, 0.1, 0.9, 0.9])

for line in get_text().split("\n"):
    y.text_wrap.add_text([Text(line, font1, new_line=True)])
scroll = []


def new_thread():
    _thread.start_new_thread(lambda: scroll.append(input()), ())


new_thread()

while interface.start.get_running():
    if scroll:
        amount = scroll.pop()
        if amount == "":
            amount = random.randint(-5, 5)
        amount = int(amount)
示例#6
0
"""Wrap a long string of text.

Must be ran from root of project.
"""
from time import sleep

from interface.display import TextBox, Text, Font
import interface.start

interface.start.init()

font1 = Font("Courier New", 20, True, True)

text = "0123456789" * 100

y = TextBox([.1, .1, .9, .9])
y.text_wrap.add_text([Text(text, font1)])

while interface.start.get_running():
    sleep(.01)
示例#7
0
Must be ran from root of project.
"""
from time import sleep

from interface.display import TextBox, Text, Font
import interface.start

interface.start.init()

font1 = Font("Courier New", 20, True, True)

text = """
The Hitchhiker's Guide to the Galaxy[1] (sometimes referred to as HG2G,[2] HHGTTG[3] or H2G2[4]) is a comedy science fiction series created by Douglas Adams. Originally a radio comedy broadcast on BBC Radio 4 in 1978, it was later adapted to other formats, including stage shows, novels, comic books, a 1981 TV series, a 1984 video game, and 2005 feature film.

A prominent series in British popular culture, The Hitchhiker's Guide to the Galaxy has become an international multi-media phenomenon; the novels are the most widely distributed, having been translated into more than 30 languages by 2005.[5][6] In 2017, BBC Radio 4 announced a 40th-anniversary celebration with Dirk Maggs, one of the original producers, in charge.[7] This sixth series of the sci-fi spoof has been based on Eoin Colfer's book And Another Thing, with additional unpublished material by Douglas Adams. The first of six new episodes was broadcast on 8 March 2018.[8]

The broad narrative of Hitchhiker follows the misadventures of the last surviving man, Arthur Dent, following the demolition of the planet Earth by a Vogon constructor fleet to make way for a hyperspace bypass. Dent is rescued from Earth's destruction by Ford Prefect, a human-like alien writer for the eccentric, electronic travel guide The Hitchhiker's Guide to the Galaxy, by hitchhiking onto a passing Vogon spacecraft. Following his rescue, Dent explores the galaxy with Prefect and encounters Trillian, another human that had been taken from Earth prior to its destruction by the President of the Galaxy, the two-headed Zaphod Beeblebrox, and the depressed Marvin, the Paranoid Android. Certain narrative details were changed between the various adaptations.

"""

x = TextBox([.1, .1, .45, .9])
y = TextBox([.55, .1, .9, .9])

for char in text:
    x.text_wrap.add_text([Text(char, font1)])
y.text_wrap.add_text([Text(text, font1)])

while interface.start.get_running():
    sleep(.01)
示例#8
0
"""Wrap text that changes randomly.

Must be ran from root of project.
"""
from time import sleep
import random
import string

from interface.display import InputBox, Text, Font
import interface.start

interface.start.init()

font1 = Font("Courier New", 20, True, True)

y = InputBox([.1, .1, .9, .9])
y.text_wrap.add_text(
    [Text("Changing", font1, highlight=(255, 125, 125), label="main")])
y.text_wrap.add_text([Text("Unchanged", font1, highlight=(125, 255, 125))])

while interface.start.get_running():
    text = ("".join(
        random.choice(string.printable)
        for i in range(0, random.randint(1, 1000))))
    y.text_wrap.change_text("main", text)
    sleep(3)
示例#9
0
"""Wrap and display all chars.

Must be ran from root of project.
"""
from time import sleep
import string
import random

from interface.display import TextBox, Text, Font
import interface.start

interface.start.init()

font1 = Font("Courier New", 50, True)

y = TextBox([.1, .1, .9, .9])

for i in range(0, 100):
    color = tuple(random.randint(0, 255) for _ in range(0, 3))
    text = string.printable * 1000
    y.text_wrap.add_text([Text(text, font1, highlight=color)])

while interface.start.get_running():
    sleep(.01)