本文整理匯總了Python中astro_pi.AstroPi.load_image方法的典型用法代碼示例。如果您正苦於以下問題:Python AstroPi.load_image方法的具體用法?Python AstroPi.load_image怎麽用?Python AstroPi.load_image使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類astro_pi.AstroPi
的用法示例。
在下文中一共展示了AstroPi.load_image方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: AstroPi
# 需要導入模塊: from astro_pi import AstroPi [as 別名]
# 或者: from astro_pi.AstroPi import load_image [as 別名]
#!/usr/bin/python
from astro_pi import AstroPi
ap = AstroPi()
ap.clear()
ap.load_image("space_invader.png")
示例2:
# 需要導入模塊: from astro_pi import AstroPi [as 別名]
# 或者: from astro_pi.AstroPi import load_image [as 別名]
else:
ap.show_message("ISS is %sC warmer" % tempDiff,text_colour=[255, 0, 0]) #display the difference in red if ISS is warmer
ap.clear()
#compare the values and set the icon
if avRain < NoRain: #if there is no rain
if avCloud < valueSun: #if it is sunny
iconFileName = sunPng
elif valueSun >= avCloudArr < valueCloudSun: #if it is cloudy
iconFileName = cloudPng
else: #otherwise it is sunny/cloudy
iconFileName = suncloudPng
elif avRain <= LightRain: #if there is light rain
iconFileName = lightRainPng
else: #otherwise it is heavy rain
iconFileName = heavyRainPng
iconFileName= pngPath + iconFileName #add the correct icon file name onto the path to the icons folder
#display end icon
ap.show_message("Likely weather") #display the words 'Likely weather'
ap.load_image(iconFileName) #display the icon image
sleep(2) #keep displaying the image for 2 seconds
#say goodbye
ap.show_message(pickMessage(goodbyes)) #display a random goodbye message