def drawWeatherInfo(self,surface): weather = WeatherModel() currentWeather = weather.getCurrentWeather() font = pygame.font.Font("fonts/Verdana.ttf", 30) font.set_bold(True) tempText = "%sºC" % currentWeather["temp"] temp = font.render(tempText, True, Config.WHITE_COLOR) font = pygame.font.Font("fonts/Verdana.ttf", 12) font.set_bold(True) windText = "%s Km/h" % currentWeather["wind"] wind = font.render(windText, True, Config.WHITE_COLOR) tempRect = temp.get_rect() tempRect.x = 375 tempRect.y = 90 surface.blit(temp,tempRect) windRect = wind.get_rect() windRect.x = self.moduleRect.centerx - (windRect.width / 2) - 10 windRect.y = 160 surface.blit(wind,windRect) imageCompass = pygame.image.load("images/minicompass.png").convert_alpha() surface.blit(imageCompass,(windRect.x + windRect.width + 5,windRect.y-8)) imageWeatherName = "images/weather%i.png" % currentWeather["sky"] imageWeather = pygame.image.load(imageWeatherName).convert_alpha() surface.blit(imageWeather,(self.moduleRect.x + 15,self.moduleRect.y + 20))
def drawCurrentWeatherInfo(self): weather = WeatherModel() currentWeather = weather.getCurrentWeather() font = pygame.font.Font("fonts/Verdana.ttf", 42) font.set_bold(True) tempText = "%sºC" % currentWeather["temp"] temp = font.render(tempText, True, Config.WHITE_COLOR) font = pygame.font.Font("fonts/Verdana.ttf", 12) font.set_bold(True) windText = "%s Km/h" % currentWeather["wind"] wind = font.render(windText, True, Config.WHITE_COLOR) maxTempText = "MAX: %sºC" % currentWeather["maxTemp"] maxTemp = font.render(maxTempText, True, Config.WHITE_COLOR) minTempText = "MIN: %sºC" % currentWeather["minTemp"] minTemp = font.render(minTempText, True, Config.WHITE_COLOR) tempRect = temp.get_rect() tempRect.x = 140 tempRect.y = 30 self.window.blit(temp,tempRect) windRect = wind.get_rect() windRect.x = 310 windRect.y = 25 self.window.blit(wind,windRect) maxTempRect = maxTemp.get_rect() maxTempRect.x = 310 maxTempRect.y = 45 + windRect.height self.window.blit(maxTemp,maxTempRect) minTempRect = minTemp.get_rect() minTempRect.x = 310 minTempRect.y = maxTempRect.y + maxTempRect.height self.window.blit(minTemp,minTempRect) imageCompass = pygame.image.load("images/minicompass.png").convert_alpha() self.window.blit(imageCompass,(windRect.x + windRect.width + 35,windRect.y-8)) imageWeatherName = "images/weather%i.png" % currentWeather["sky"] imageWeather = pygame.image.load(imageWeatherName).convert_alpha() self.window.blit(imageWeather,(40,20))