本文整理汇总了Python中pylcdsysinfo.LCDSysInfo.set_text_background_colour方法的典型用法代码示例。如果您正苦于以下问题:Python LCDSysInfo.set_text_background_colour方法的具体用法?Python LCDSysInfo.set_text_background_colour怎么用?Python LCDSysInfo.set_text_background_colour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylcdsysinfo.LCDSysInfo
的用法示例。
在下文中一共展示了LCDSysInfo.set_text_background_colour方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main_loop
# 需要导入模块: from pylcdsysinfo import LCDSysInfo [as 别名]
# 或者: from pylcdsysinfo.LCDSysInfo import set_text_background_colour [as 别名]
def main_loop(bg=None, fg=None):
update_display_period = 1 # number of seconds to wait before updating display
floor = math.floor # minor optimization
if bg is None:
bg = BackgroundColours.BLACK
if fg is None:
fg = TextColours.GREEN
line_num = 3
d = LCDSysInfo()
d.clear_lines(TextLines.ALL, bg)
d.dim_when_idle(False)
d.set_brightness(127)
d.save_brightness(127, 255)
d.set_text_background_colour(bg)
class Data(object):
def __init__(self, d):
self.d = d
self.count = 0
data = Data(owner)
def onbuttondown(data):
data.count += 1
data.d.display_text_on_line(line_num, str(data.count), False, None, fg)
read_wait(onbuttondown=functools.partial(onbuttondown, owner))
示例2: clock_loop
# 需要导入模块: from pylcdsysinfo import LCDSysInfo [as 别名]
# 或者: from pylcdsysinfo.LCDSysInfo import set_text_background_colour [as 别名]
def clock_loop(bg=None, fg=None):
update_display_period = 1 # number of seconds to wait before updating display
floor = math.floor # minor optimization
if bg is None:
bg = BackgroundColours.BLACK
if fg is None:
fg = TextColours.GREEN
line_num = 3
d = LCDSysInfo()
d.clear_lines(TextLines.ALL, bg)
d.dim_when_idle(False)
d.set_brightness(127)
d.save_brightness(127, 255)
d.set_text_background_colour(bg)
while 1:
clock_str = str(datetime.datetime.now()).split('.')[0]
d.display_text_on_line(line_num, clock_str, False, None, fg)
# Work out when to wake up for the next round/whole (non-fractional) time
start_time = time.time()
future_time = floor(start_time) + update_display_period # pure float math
sleep_time = future_time - start_time
time.sleep(sleep_time)
示例3: clock_loop
# 需要导入模块: from pylcdsysinfo import LCDSysInfo [as 别名]
# 或者: from pylcdsysinfo.LCDSysInfo import set_text_background_colour [as 别名]
def clock_loop(bg=None, fg=None):
update_display_period = 1 # number of seconds to wait before updating display
floor = math.floor # minor optimization
if bg is None:
bg = BackgroundColours.BLACK
if fg is None:
fg = TextColours.WHITE
line_num = 1
d = LCDSysInfo()
d.clear_lines(TextLines.ALL, bg)
d.dim_when_idle(False)
d.set_brightness(127)
d.save_brightness(127, 255)
d.set_text_background_colour(bg)
jsonAfdak = domoticzData(805)
jsonBuiten = domoticzData(16)
jsonBinnen = domoticzData(447)
jsonPower = domoticzData(616)
d.display_text_on_line(2, 'Buiten:' + jsonBuiten['result'][0]['Data'], False, None, fg)
d.display_text_on_line(3, 'Afdak:' + jsonAfdak['result'][0]['Data'], False, None, fg)
d.display_text_on_line(4, 'Binnen:' + jsonBinnen['result'][0]['Data'], False, None, fg)
d.display_text_on_line(5, 'Verbruik:' + jsonPower['result'][0]['Usage'], False, None, fg)
d.display_text_on_line(6, 'Vandaag:' + jsonPower['result'][0]['CounterToday'], False, None, fg)
#print(jsonBuiten['Result']['Name'])
print(jsonBuiten['result'][0]['Data'])
timeout = time.time() + 60*2
while 1:
clock_str = str(datetime.datetime.now()).split('.')[0]
d.display_text_on_line(line_num, clock_str, False, None, fg)
if (time.time() > timeout):
break
# Work out when to wake up for the next round/whole (non-fractional) time
start_time = time.time()
future_time = floor(start_time) + update_display_period # pure float math
sleep_time = future_time - start_time
time.sleep(sleep_time)
print('stopped after timeout')
d.clear_lines(TextLines.ALL, bg)
d.dim_when_idle(False)
d.set_brightness(0)
d.save_brightness(0, 255)
d.set_text_background_colour(bg)
示例4: main
# 需要导入模块: from pylcdsysinfo import LCDSysInfo [as 别名]
# 或者: from pylcdsysinfo.LCDSysInfo import set_text_background_colour [as 别名]
def main():
uptime = getUptime()
bg = BackgroundColours.BLACK
fb = TextColours.WHITE
d = LCDSysInfo()
d.clear_lines(TextLines.ALL, bg)
d.dim_when_idle(False)
d.set_brightness(127)
d.save_brightness(127, 255)
d.set_text_background_colour(bg)
d.display_text_on_line(3, "Uptime:", False, None, fb)
d.display_text_on_line(4, uptime, False, None, fb)
示例5: str
# 需要导入模块: from pylcdsysinfo import LCDSysInfo [as 别名]
# 或者: from pylcdsysinfo.LCDSysInfo import set_text_background_colour [as 别名]
# read and 'strip' the resulting string so that it can be used.
# this is the response as string
str1 = str(web_pg)
# search for the following string
str2 = 'e":"'
# look for it in the result
subStringFindInt = str1.find(str2)
# strip the string to 'keep' the price
substringprice = str1[subStringFindInt + 4 :]
# extract the price
price = substringprice[0 : 0 + 6]
# get the balance from our remote bitcoind and store it.
btcbalance = str(conn.getbalance())
# Refresh the background and make it black
display.set_text_background_colour(BackgroundColours.BLACK)
# loop through each line to display, filling in the variables.
for line in range(1, 7):
if line == 1:
display.display_text_on_line(
line, "1 btc at MtGox", True, (TextAlignment.RIGHT, TextAlignment.RIGHT), TextColours.GREY
)
elif line == 2:
display.display_text_on_line(
line, str(price) + " USD", True, (TextAlignment.LEFT, TextAlignment.LEFT), TextColours.GREY
)
elif line == 3:
display.display_text_on_line(
line, "Local Bitcoind: ", True, (TextAlignment.RIGHT, TextAlignment.RIGHT), TextColours.RED
)
示例6: LCDSysInfo
# 需要导入模块: from pylcdsysinfo import LCDSysInfo [as 别名]
# 或者: from pylcdsysinfo.LCDSysInfo import set_text_background_colour [as 别名]
try:
# start the logger
logging.basicConfig(filename='screen.log',format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.DEBUG)
logging.info('Script Started!')
# generate client name and connect to mqtt
mypid = os.getpid()
client_uniq = "pubclient_"+str(mypid)
# set the screen up
d = LCDSysInfo()
d.clear_lines(TextLines.ALL, bg)
d.dim_when_idle(False)
d.set_brightness(127)
d.save_brightness(127, 255)
d.set_text_background_colour(bg)
# connect mqtt
connect()
#remain connected and publis
mqttc.loop_forever()
# bad
logging.info("Dropped out of the loop, Exiting")
time.sleep(2)
sys.exit(1)
except Exception, e:
# exit with error, supervisord will restart it.
d.clear_lines(TextLines.ALL, bg)
示例7: LCDSysInfo
# 需要导入模块: from pylcdsysinfo import LCDSysInfo [as 别名]
# 或者: from pylcdsysinfo.LCDSysInfo import set_text_background_colour [as 别名]
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from pylcdsysinfo import BackgroundColours, TextColours, TextAlignment, TextLines, LCDSysInfo
from time import sleep
d = LCDSysInfo()
d.clear_lines(TextLines.ALL, BackgroundColours.BLACK)
d.dim_when_idle(False)
d.set_brightness(255)
d.save_brightness(127, 255)
d.set_text_background_colour(BackgroundColours.BLACK)
d.display_cpu_info(8010, 32, TextColours.RED, TextColours.WHITE)
d.display_ram_gpu_info(1994, 32, TextColours.RED, TextColours.GREEN)
d.display_network_info(1, 2, TextColours.RED, TextColours.GREEN, 0, 1)
d.display_fan_info(1994, 1994, TextColours.RED, TextColours.GREEN)
for pos in range(0, 48):
d.display_icon(pos, 1 + pos % 32)
d.clear_lines(63, BackgroundColours.WHITE)
d.set_text_background_colour(BackgroundColours.BLUE)
sleep(1)
for line in range(1, 7):
d.display_text_on_line(line, "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", False, TextAlignment.LEFT, TextColours.WHITE)