本文整理匯總了Python中Menu.Menu.topElement方法的典型用法代碼示例。如果您正苦於以下問題:Python Menu.topElement方法的具體用法?Python Menu.topElement怎麽用?Python Menu.topElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Menu.Menu
的用法示例。
在下文中一共展示了Menu.topElement方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Adafruit_CharLCDPlate
# 需要導入模塊: from Menu import Menu [as 別名]
# 或者: from Menu.Menu import topElement [as 別名]
#Daniel Juenger, github.com/sleeepyjack
from time import sleep
#import Adafruit_CharLCD as LCD
#from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
from Menu import Menu
lcd = Adafruit_CharLCDPlate()
menu = Menu()
#The menu can show strings, bash and python expressions
# topElement( Name , Type of content , Lower row content)
top1 = menu.topElement("< System >", "STRING", " v")
top2 = menu.topElement("< Network >", "STRING", " v")
top3 = menu.topElement("< top3 >", "STRING", " v")
top4 = menu.topElement("< top4 >", "STRING", " v")
top5 = menu.topElement("< top5 >", "STRING", " v")
sub11 = menu.subElement("System>Hostname", "BASH", "hostname")
sub12 = menu.subElement("System>CPU", "PYTHON", 'str(str(psutil.cpu_percent()) + "%")')
sub13 = menu.subElement("System>CPU-Temp.", "BASH", "/opt/vc/bin/vcgencmd measure_temp | cut -d '=' -f2")
sub14 = menu.subElement("System>CPU-Proceses", "BASH", "ps ax | wc -l | tr -d \" \" ")
sub15 = menu.subElement("System>RAM", "PYTHON", 'str(str(psutil.phymem_usage()[3])+"% used")')
sub16 = menu.subElement("System>Kernel", "BASH", "uname -srmo")
sub21 = menu.subElement("Network>SSID", "BASH", "iwconfig wlan0 | grep 'ESSID:' | awk '{print $4}' | sed 's/ESSID://g'")
sub22 = menu.subElement("Network>Signal", "BASH", "iwconfig wlan0 | awk -F'[ =]+' '/Signal level/ {print $7}' | cut -d/ -f1")