no winapi
This commit is contained in:
parent
b259b624e4
commit
41a113bd6b
@ -1,4 +1,3 @@
|
|||||||
import _winapi
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
os.system('')
|
os.system('')
|
||||||
@ -33,23 +32,6 @@ def color_print(*args):
|
|||||||
print(f'\033[{line}m{out}\033[0m')
|
print(f'\033[{line}m{out}\033[0m')
|
||||||
|
|
||||||
|
|
||||||
if os.name == "nt":
|
|
||||||
from ctypes import windll
|
|
||||||
from ctypes.wintypes import BOOL, HANDLE, WORD
|
|
||||||
|
|
||||||
handle = _winapi.GetStdHandle(_winapi.STD_OUTPUT_HANDLE)
|
|
||||||
kernel32 = windll.LoadLibrary("Kernel32.dll")
|
|
||||||
SetConsoleAttribute = kernel32.SetConsoleTextAttribute
|
|
||||||
SetConsoleAttribute.argtypes = (HANDLE, WORD)
|
|
||||||
SetConsoleAttribute.restype = BOOL
|
|
||||||
# FOREGROUND_INTENSITY|FOREGROUND_RED
|
|
||||||
res: bool = SetConsoleAttribute(handle, 5)
|
|
||||||
print(res)
|
|
||||||
string = "Hello World!"
|
|
||||||
_winapi.WriteFile(handle, string.encode("utf-8"), 0)
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
reset_color = '\033[0m'
|
reset_color = '\033[0m'
|
||||||
|
|
||||||
# exit(0)
|
# exit(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user