當前位置: 首頁>>代碼示例>>Python>>正文


Python AstroPi.load_image方法代碼示例

本文整理匯總了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")
開發者ID:New380,項目名稱:astro-pi-hat,代碼行數:8,代碼來源:space_invader.py

示例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
開發者ID:astro-pi,項目名稱:AstroPiWeatherEntry,代碼行數:32,代碼來源:AstroPiFinal.py


注:本文中的astro_pi.AstroPi.load_image方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。