lcd.py
von smutbert- SNIPPET_TEXT:
-
- import socket
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- def lcd_open(host, port):
- s.connect((host, port))
- lcdproc_version = lcd_cmd('hello') # is wichtig!
- lcd_cmd('client_set name orpheus')
- def lcd_close():
- lcd_cmd('screen_set ' + 'commando' + ' backlight off')
- s.close()
- def lcd_cmd(lcdproc_cmd):
- s.send(lcdproc_cmd + '\n')
- def lcd_text(msg_text):
- lcd_cmd('screen_add ' + 'commando')
- lcd_cmd('screen_set ' + 'commando' + ' -priority alert -heartbeat off')
- lcd_cmd('screen_set ' + 'commando' + ' -timeout 16')
- lcd_cmd('widget_add ' + 'commando' + ' anzeige' + ' string')
- lcd_cmd('widget_set ' + 'commando' + ' anzeige' + ' 1 1 ' + '"' + msg_text + '"')
- def lcd_scroll(speed, msg_text):
- lcd_cmd('screen_add ' + 'commando')
- lcd_cmd('screen_set ' + 'commando' + ' -priority alert -heartbeat off')
- lcd_cmd('screen_set ' + 'commando' + ' -timeout 32')
- lcd_cmd('widget_add ' + 'commando' + ' anzeige' + ' scroller')
- lcd_cmd('widget_set ' + 'commando' + ' anzeige' + ' 1 1 18 1 ' + 'h ' +str(speed) + ' "' + msg_text + '"')
- lcd_cmd('widget_add ' + 'commando' + ' anzeige2' + ' string')
- lcd_cmd('widget_set ' + 'commando' + ' anzeige2' + ' 20 1 ' + '>')
- def lcd_hbar(length):
- lcd_cmd('screen_add ' + 'commando')
- lcd_cmd('screen_set ' + 'commando' + ' -priority alert -heartbeat off')
- lcd_cmd('screen_set ' + 'commando' + ' -timeout 16')
- lcd_cmd('widget_add ' + 'commando' + ' anzeige' + ' hbar')
- lcd_cmd('widget_set ' + 'commando' + ' anzeige' + ' 1 1 ' + str(length))
- def lcd_icon(icon_name):
- lcd_cmd('screen_add ' + 'commando')
- lcd_cmd('screen_set ' + 'commando' + ' -priority alert -heartbeat off')
- lcd_cmd('screen_set ' + 'commando' + ' -timeout 16')
- lcd_cmd('widget_add ' + 'commando' + ' anzeige' + ' icon')
- lcd_cmd('widget_set ' + 'commando' + ' anzeige' + ' 1 1 ' + '"' + icon_name + '"')
Quellcode
Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN