def refresh(self): if self.oldpos: x, y = self.oldpos screen.show(x, y, ' ') x, y = self._getpos() self.oldpos = [x, y] screen.show(x, y, screen.c(const.FORE_WHITE, const.BACK_YELLOW, 'X'))
def _draw_map(self): for i in range(self.originX, self.originX+self.map_width+1): screen.show(i, self.originY-1, '-') for i in range(self.originX, self.originX+self.map_width+1): screen.show(i, self.originY+self.map_height+1, '-') for i in range(self.originY, self.originY+self.map_height+1): screen.show(self.originX-1, i, '|') for i in range(self.originY, self.originY+self.map_height+1): screen.show(self.originX+self.map_width+1, i, '|') screen.show(self.originX+5, self.originY-1, ' LOL ')
def _draw_status(self): ox, oy = 7, 30 screen.show(ox, oy, 'HP') length = 20 screen.progress(ox+3, oy, self.hp, self.HP_TOTAL, length=length) screen.show(ox+length+4, oy, '[%d/%d] ' %(self.hp, self.HP_TOTAL)) screen.show(ox, oy+2, 'BP') screen.progress(ox+3, oy+2, self.bp, self.BP_TOTAL, color=const.BACK_BLUE, length=length) screen.show(ox+length+4, oy+2, '[%d/%d] ' %(self.bp, self.BP_TOTAL))
click.append(x) click.append(y) while len(possible) > 0: # zera o vetor possible possible.remove(possible[0]) if ( tabuleiro[y][x][0] == 'B' ): # qualquer uma joga agora... # turn): # se for a vez da cor selecionada, ver possibilidades possible += chess_move.move(literal[1], tabuleiro) screen.click = click screen.possible = possible while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() exit() if event.type == pygame.MOUSEBUTTONUP: render = True literal[0] = literal[1] literal[1] = (chr(97 + get_cord_pos(pygame.mouse.get_pos())[0]) + str(8 - get_cord_pos(pygame.mouse.get_pos())[1])) mouse_click(pygame.mouse.get_pos()) if render: # só renderiza a tela quando precisa screen.show(tabuleiro) render = False
import connect import screen import utime import ntptime from dht22 import Dht from screen import Screen from adafruit_io_client import Client dht=Dht() screen=Screen() adafruit_client=Client() connect.connect() ntptime.settime() while True: t = utime.localtime(utime.time()) m=dht.measure() screen.text('%02d:%02d:%02d' % (t[3], t[4], t[5]), 0) screen.text('t: %2.1f' % m[0], 2) screen.text('h: %2.1f' % m[1], 4) screen.show() adafruit_client.publish(m[0], m[1]) utime.sleep(60)
import screen import temp_internal import temp_external from utime import sleep from light import get_light from led import blink import _thread screen = screen.DigitScreen() while True: screen.show("{}C".format(int(temp_internal.get_temperature())), t=3) screen.show("{}c".format(int(temp_external.get_temperature(27)[0])), t=3) screen.show("L{}".format(int(get_light(28))), t=3) screen.show("{}".format(int(temp_external.get_temperature(27)[1])), t=3) _thread.start_new_thread(blink, (25, 0.1, 3))
def _draw_time(self, curr=0.0): tstr = time.strftime(' [%0H:%0M:%0S] ', time.gmtime(curr)) screen.show(self.originX+40, self.originY-1, tstr)
def fly(): for i in range(1, maxlen): i == 1 or screen.show(x+i-1, y, ' ') screen.show(x+i, y, weapon) time.sleep(0.1) screen.show(x+maxlen-1, y, ' ')