Skip to content

Commit

Permalink
Resolution probleme des couleurs selon l'os
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimed committed May 22, 2019
1 parent 70ae133 commit 62c9971
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions poetry/V/affichage.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from sys import platform
from sys import platform as _platform
import platform
from os import system

import os

def clear_console():

"""
Nettoie la console(cmd)
"""

if platform == "linux" or platform == "linux2" or platform == "darwin":
if _platform == "linux" or _platform == "linux2" or _platform == "darwin":
# Linux et MacOS
system('clear')
elif platform == "win32":
elif _platform == "win32" :
# Windows
system('cls')

Expand All @@ -22,18 +23,47 @@ def clear_console():
"""

def error_message(txt):
#rouge
return "\033[91m{}\033[00m".format(txt)

def error_message(txt):
#rouge
if _platform == "linux" or _platform == "linux2" or _platform == "darwin" :
return "\033[91m{}\033[00m".format(txt)
elif _platform == "win32" or _platform == "win64" :
ver = platform.version()
if ver[:2] == '10':
return "\033[91m{}\033[00m".format(txt)
else :
return txt
else :
return txt

def correct_message(txt):
#vert
return "\033[92m{}\033[00m".format(txt)
if _platform == "linux" or _platform == "linux2" or _platform == "darwin" :
return "\033[92m{}\033[00m".format(txt)
elif _platform == "win32" :
ver = platform.version()
if ver[:2] == '10':
return "\033[92m{}\033[00m".format(txt)
else :
return txt

else :
return txt

def warning_message(txt):
#jaune
return "\033[93m{}\033[00m".format(txt)

if _platform == "linux" or _platform == "linux2" or _platform == "darwin" :
return "\033[93m{}\033[00m".format(txt)
elif _platform == "win32" :
ver = platform.version()
if ver[:2] == '10':
return "\033[93m{}\033[00m".format(txt)
else :
return txt

else :
return txt

def tps_gen(nb_lignes) :

Expand Down

0 comments on commit 62c9971

Please sign in to comment.