Skip to content

Commit 385733f

Browse files
author
renzon
committed
Funcionando, mas no Linux tem que apertar enter para inputar os dados
1 parent 257f9fa commit 385733f

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

placa_grafica.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
import platform
33
import time
44
import sys
5-
import msvcrt
5+
6+
try:
7+
import msvcrt
8+
except:
9+
pass
610
import select
711
from templates import FIM
812

913

10-
apagar_tela = lambda: os.system('cls') if platform.system() == 'Windows' else lambda: os.system('clear')
14+
eh_windows = platform.system() == 'Windows'
15+
apagar_tela = lambda: os.system('cls') if eh_windows else lambda: os.system('clear')
1116

1217
# workaround retirado de http://stackoverflow.com/questions/292095/polling-the-keyboard-in-python
1318

@@ -19,7 +24,7 @@ def ouvir_teclado():
1924
return False
2025

2126

22-
if platform.system() == 'Windows':
27+
if eh_windows:
2328
ouvir_teclado = msvcrt.kbhit
2429

2530
LARGURA = 80
@@ -45,9 +50,12 @@ def _animar(delta_t, fase, passo, tempo, msg):
4550
def _jogar(delta_t, fase, passo, tempo, msg):
4651
while not fase.acabou(tempo):
4752
tempo = desenhar_e_esperar(delta_t, fase, passo, tempo, msg)
48-
if ouvir_teclado():
53+
entrada = ouvir_teclado()
54+
if entrada:
4955
while True:
5056
try:
57+
if not eh_windows:
58+
input()
5159
angulo = float(input('Digite o Ângulo de Lançamento: '))
5260
fase.lancar(angulo, tempo)
5361
break

0 commit comments

Comments
 (0)