本文整理匯總了Python中Menu.Menu.top_element方法的典型用法代碼示例。如果您正苦於以下問題:Python Menu.top_element方法的具體用法?Python Menu.top_element怎麽用?Python Menu.top_element使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Menu.Menu
的用法示例。
在下文中一共展示了Menu.top_element方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Menu
# 需要導入模塊: from Menu import Menu [as 別名]
# 或者: from Menu.Menu import top_element [as 別名]
# coding=utf-8
# Daniel Juenger, github.com/sleeepyjack
# updated to 3.x - James L. Key
from time import sleep
import Adafruit_CharLCD as Lcd
from Menu import Menu
lcd = Lcd.Adafruit_CharLCDPlate()
menu = Menu()
# The menu can show strings, bash and python expressions
# --------- top_element( Name , Type of content , Lower row content)
top1 = menu.top_element("< Network >", "STRING", " v")
top2 = menu.top_element("< System >", "STRING", " v")
top3 = menu.top_element("< top3 >", "STRING", " v")
top4 = menu.top_element("< top4 >", "STRING", " v")
top5 = menu.top_element("< top5 >", "STRING", " v")
sub11 = menu.sub_element("Net.>Signal", "BASH",
"iwconfig wlan0 | awk -F'[ =]+' '/Signal level/ {print $7}' | cut -d/ -f1")
sub12 = menu.sub_element("Net.>SSID", "BASH",
"iwconfig wlan0 | grep 'ESSID:' | awk '{print $4}' | sed 's/ESSID://g'")
sub13 = menu.sub_element("Net.>Internet", "BASH",
"ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && echo ok || echo error")
sub21 = menu.sub_element("System>CPU", "PYTHON3",
'str(str(psutil.cpu_percent()) + "%")')
sub22 = menu.sub_element("System>CPU-Temp.", "STRING", "TODO")
sub23 = menu.sub_element("System>RAM", "PYTHON3",
'str(str(psutil.virtual_memory()[2])+"% used")')