Esempio n. 1
0
def feedme(feed):
    feed = feedparser.parse(feed.encode('utf-8'))
    for i in range(1):
        print(feed['entries'][i]['title'])
    write_string(feed['entries'][0]['title'], offset_x=1)
    scroll()
    show()
    time.sleep(0.05)
Esempio n. 2
0
    def render_string(s,
                      scroll_x=8,
                      scroll_y=0,
                      scroll_sleep=1,
                      kerning_flag=False):
        # init view
        clear()

        # render string
        write_string(s, kerning=kerning_flag)
        show()
        time.sleep(scroll_sleep)

        # render to end
        for i in range(len(s)):
            # scroll -> render
            scroll(scroll_x, scroll_y)
            show()
            time.sleep(scroll_sleep)
Esempio n. 3
0
def display_strings_array(lines):
    delay = 0.03

    line_height = microdotphat.HEIGHT + 2

    lengths = [0] * len(lines)

    offset_left = 0

    for line, text in enumerate(lines):
        lengths[line] = microdotphat.write_string(text,
                                                  offset_x=offset_left,
                                                  offset_y=line_height * line,
                                                  kerning=False)
        offset_left += lengths[line]

    microdotphat.set_pixel(0, (len(lines) * line_height) - 1, 0)

    current_line = 0

    microdotphat.show()

    pos_x = 0
    pos_y = 0
    for current_line in range(len(lines)):
        time.sleep(delay * 10)
        for y in range(lengths[current_line]):
            microdotphat.scroll(1, 0)
            pos_x += 1
            time.sleep(delay)
            microdotphat.show()
        if current_line == len(lines) - 1:
            microdotphat.scroll_to(0, 0)
        else:
            for x in range(line_height):
                microdotphat.scroll(0, 1)
                pos_y += 1
                microdotphat.show()
                time.sleep(delay)
Esempio n. 4
0
import time
from microdotphat import write_string, scroll, clear, show

clear()
write_string('Forecast, SNOWCATS!   ')

while True:
    scroll()
    show()
    time.sleep(0.01)
Esempio n. 5
0
    ) as url:
        data = json.loads(url.read())
        days = list(data.keys())
        res = []
        for el in days:
            try:
                res.append(int(el))
            except ValueError:
                pass
            print(res)

            for i in data[str(res[-1])].values():
                mn = int((i["mn"]))
                mx = int(i["mx"])
                break
    text = "The live temp on Mars on day " + str(res[-1]) + " is max: " + str(
        mx) + "c and min: " + str(mn) + "c          "
    print(text)
    write_string(text, offset_x=0, kerning=False)
    show()


job()
schedule.every().day.at("00:00").do(job)
while True:
    schedule.run_pending()
    scroll(amount_x=8)
    show()
    time.sleep(0.2)
time.sleep(1)
    lengths[line] = write_string(text, offset_x=offset_left, offset_y=line_height * line)
    offset_left += lengths[line]

set_pixel(0, (len(lines) * line_height) - 1, 0)

current_line = 0

show()

while True:
    pos_x = 0
    pos_y = 0
    for current_line in range(len(lines)):
        time.sleep(delay*10)
        for y in range(lengths[current_line]):
            scroll(1,0)
            pos_x += 1
            time.sleep(delay)
            show()
        if current_line == len(lines) - 1 and rewind:
            for y in range(pos_y):
                scroll(-int(pos_x/pos_y),-1)
                show()
                time.sleep(delay)
            scroll_to(0,0)
            show()
            time.sleep(delay)
        else:
            for x in range(line_height):
                scroll(0,1)
                pos_y += 1
Esempio n. 7
0
def phat():
    while True:
        microdotphat.scroll()
        microdotphat.show()
        time.sleep(0.01)
Esempio n. 8
0
#!/usr/bin/env python

import time
import sys

import microdotphat             


print("""Scrolling Text

Scrolls a single word char by char across the screen.

Usage: {name} "your message"

Press Ctrl+C to exit.
""".format(name=sys.argv[0]))

text = "Ninja"

if len(sys.argv) > 1:
    text = sys.argv[1]

microdotphat.write_string(text, offset_x=0, kerning=False)
microdotphat.show()
time.sleep(0.5)

while True:
    microdotphat.scroll(amount_x=8)
    microdotphat.show()
    time.sleep(0.5)
Esempio n. 9
0
                                 offset_y=line_height * line)
    offset_left += lengths[line]

set_pixel(0, (len(lines) * line_height) - 1, 0)

current_line = 0

show()

while True:
    pos_x = 0
    pos_y = 0
    for current_line in range(len(lines)):
        time.sleep(delay * 10)
        for y in range(lengths[current_line]):
            scroll(1, 0)
            pos_x += 1
            time.sleep(delay)
            show()
        if current_line == len(lines) - 1 and rewind:
            for y in range(pos_y):
                scroll(-int(pos_x / pos_y), -1)
                show()
                time.sleep(delay)
            scroll_to(0, 0)
            show()
            time.sleep(delay)
        else:
            for x in range(line_height):
                scroll(0, 1)
                pos_y += 1
Esempio n. 10
0
#!/usr/bin/env python

import time
import sys
             
from microdotphat import write_string, scroll, show


print("""Scrolling Text

Scrolls a message across the screen.

Usage: {name} "your message"

Press Ctrl+C to exit.
""".format(name=sys.argv[0]))

text = "In the old #BILGETANK we'll keep you in the know!      "

if len(sys.argv) > 1:
    text = sys.argv[1]

write_string(text, offset_x=0)

while True:
    scroll()
    show()
    time.sleep(0.05)
Esempio n. 11
0
## OPIERDALACZ EKRANIKU MICRO DOT PHAT
##                (c)P1X
##

import time
import random
import microdotphat as dot

logo_time = 10
delay_time = 0
delay_time_max = 400

loading = ['P', 'P1', 'P1X', 'P1X_', 'P1X__', 'P1X___', '_LOAD_']
msg = '      - -=<<+<   P 1 X   >+>>=- -      visit ---> HTTP://P1X.IN   - -=<+>=- -  Inde Games  - -=<+>=- -  Source Code  - -=<+>=- -  Pixel Art  - -=<+>=- -  GODOT ENGiNE  - -=<+>=- -  PiCO-8  - -=<+>=- -     '

dot.clear()
dot.set_rotate180(True)

for str in loading:
    dot.write_string(str, kerning=False)
    dot.show()
    time.sleep(0.2)

dot.clear()
dot.write_string(msg)
dot.show()

while True:
    dot.scroll()
    dot.show()