def getScreenshot(): """Retorna um screenshot da tela naquele momento""" tela = CApplication.getDesenhoTelaAtual() saida = '' for i in range(0, len(tela), EngineConsole.width()): saida += tela[i:min(i+EngineConsole.width(), len(tela))] + '\n' return saida
def _desenharBordaTela(tela): """Retorna a tela com a borda""" newTela = ' /' + '-'*(EngineConsole.width()-4) + '\\ ' for linha in tela.split('\n'): newTela += '|{0:<{1}}|'.format(linha, EngineConsole.width()-2) for _i in range(EngineConsole.height()-3-len(tela.split('\n'))): newTela += '|{0:<{1}}|'.format('', EngineConsole.width()-2) newTela += ' \\' + '-'*(EngineConsole.width()-4) + '/' return newTela
def _getDesenhoTela(): """Retorna a tela ja formatada para ser mostrada""" tam = EngineConsole.width() if CApplication._DESENHAR_BORDA: tam -= 2 tela = CApplication._TELA_PRINCIPAL.desenhoTelaConsole(tam) return CApplication._ajustarTela(tela)
def _ajustarTela(tela): """Ajusta a tela de acordo com o valor de _DESENHA_BORDA""" if CApplication._DESENHAR_BORDA: return CApplication._desenharBordaTela(tela) else: newTela = '' for linha in tela.split('\n'): newTela += '{0:<{1}}'.format(linha, EngineConsole.width()) return newTela
#-*- coding: utf-8 -*- import sys sys.path.append("C:/Users/infox/My Documents/Aptana Studio 3 Workspace/mensageiroConsole/src") from engineConsole.base.engine import EngineConsole EngineConsole.setTitle("Titulo") print("Isso não deveria aparecer") EngineConsole.clear() print("Height:", EngineConsole.height(), "- Width:", EngineConsole.width()) print("Erro!") assert EngineConsole.x() == 0 assert EngineConsole.y() == 2 EngineConsole.printxy(0, 1, "Certo!") assert EngineConsole.x() == 0 assert EngineConsole.y() == 2 EngineConsole.ungetch("t") t = EngineConsole.readkey() assert t.key == "t" and t.code == 116 print("OK") EngineConsole.readkey()