コード例 #1
0
ファイル: example_lcd.py プロジェクト: TzaCow/libLCDUI
#!/usr/bin/python

import Adafruit_CharLCD
import libLCDUI

lcd = Adafruit_CharLCD.Adafruit_CharLCDPlate()
ui = libLCDUI.ui(lcd, width=16, height=2)

message = libLCDUI.text(6, 1)
progress = libLCDUI.horizontal_position_bar(8, 1, 0, 50)
volume = libLCDUI.vertical_position_bar(1, 2, 0, 50)
alert = libLCDUI.text(8, 2)
listtest = libLCDUI.list(10, 2)

message.write("Test ~[NOTE]")
listtest.write("Option 1", "Option 2", "Option 3", "Option 4", "Option 5")
listtest.set_indicator("~[RIGHT_SMALL]")
ui.set_color(0.2, 0.8, 0.1)

#ui.add_widget(message,0,8)
#ui.add_widget(progress,1,8)
ui.add_widget(volume, 0, 0)
ui.add_widget(alert, 0, 1)
ui.add_widget(listtest, 0, 4)

for widget in ui.list_widgets():
    print widget.name

v = 0
while True:
    v += 1
コード例 #2
0
#!/usr/bin/python

import Adafruit_CharLCD
import libLCDUI
import time

#lcd = Adafruit_CharLCD.Adafruit_CharLCDPlate()
#ui = libLCDUI.ui(lcd, width=16, height=2)
ui = libLCDUI.ui(width=20, height=2)

song = libLCDUI.text(0, 0, 16, 1)
artist = libLCDUI.text(0, 0, 18, 1)
artist.set_name("Artist")
timec = libLCDUI.text(1, 0, 6, 1)
progress = libLCDUI.horizontal_position_bar(1, 7, 9, 1, 0, 36)
volume = libLCDUI.horizontal_progress_bar(1, 4, 8, 1, 0, 100)
volumet = libLCDUI.text(0, 3, 10, 2)

song.write("Take Five")
artist.write("~[NOTE] Dave Brubeck ~[NOTE] And His Jazz Masters")
timec.write("00:00")
progress.write(0)
volume.write(50)
volumet.write("  Volume:  ", "           ")

ui.add_widget(song)
ui.add_widget(timec)
ui.add_widget(progress)
ui.add_widget(artist)
ui.add_widget(volumet)
ui.add_widget(volume)
コード例 #3
0
#!/usr/bin/python

import libLCDUI
import theme
import time

ui = libLCDUI.ui(width=16, height=4)

#timer    = libLCDUI.text(0, 0, 6, 1)
#progress = libLCDUI.horizontal_position_bar(row=2,col=0,width=16,height=2,current_value=0,max_value=40,reverse_direction=False)
#ui.add_widget(progress)
#ui.add_widget(timer)

message = libLCDUI.text(0, 0, 10, 3)
count = libLCDUI.text(0, 10, 6, 2)
progress = libLCDUI.horizontal_progress_bar(3, 0, 16, 1, 0, 16)
ui.add_widget(progress)
ui.add_widget(message)
ui.add_widget(count)

i = 0
while i <= 16:
    ui.redraw()
    time.sleep(0.1)
    key = input("Button?")
    message.write("Key:", key)
    count.write("Count:", i)
    progress.write(i)
    i = i + 1
コード例 #4
0
#!/usr/bin/python

import libLCDUI
import theme
import time

ui = libLCDUI.ui(width=20, height=4)

status = libLCDUI.text(3, 0, 18, 1)
list = libLCDUI.list(0, 0, 18, 3)

list.write("Option 1", "Option 2", "Option 3", "Option 4", "Option 5",
           "Final option")
list.add_item("Really final")

position = libLCDUI.vertical_position_bar(0, 19, 1, 4, 0,
                                          list.get_number_of_items())

ui.add_widget(status)
ui.add_widget(list)
ui.add_widget(position)

ui.print_widgets()

key = ""

while True:
    time.sleep(0.1)
    if key == "":
        pass
    elif key in "uU":
コード例 #5
0
ファイル: test_stdout.py プロジェクト: TzaCow/libLCDUI
import libLCDUI
import time

ui = libLCDUI.ui()

bg = libLCDUI.text(0, 0, 20, 4)
volume = libLCDUI.text(1, 1, 10, 2)
counter = libLCDUI.text(1, 10, 7, 2)
warning = libLCDUI.notify(1, 3, 14, 2, 3, 0)

ui.add_widget(bg)
ui.add_widget(volume)
ui.add_widget(counter)
ui.add_widget(warning)

ui.print_errors()

bg.write("." * 20, "." * 20, "." * 20, "." * 20)
volume.write("Volume:", "  70%")

i = 0
while True:
    ui.redraw()
    time.sleep(0.5)
    i += 1
    counter.write("Counter:", ("%d" % i).center(7, "-"))
    if i > 10:
        i = 0
        warning.write("  1 message:  ", "  > Battery low  ")