ConsoleLib 0.1.0__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- consolelib-1.0.0/ConsoleLib/__init__.py +70 -0
- {consolelib-0.1.0 → consolelib-1.0.0}/ConsoleLib.egg-info/PKG-INFO +2 -2
- {consolelib-0.1.0 → consolelib-1.0.0}/PKG-INFO +2 -2
- {consolelib-0.1.0 → consolelib-1.0.0}/README.md +1 -1
- {consolelib-0.1.0 → consolelib-1.0.0}/pyproject.toml +1 -1
- consolelib-0.1.0/ConsoleLib/__init__.py +0 -34
- {consolelib-0.1.0 → consolelib-1.0.0}/ConsoleLib.egg-info/SOURCES.txt +0 -0
- {consolelib-0.1.0 → consolelib-1.0.0}/ConsoleLib.egg-info/dependency_links.txt +0 -0
- {consolelib-0.1.0 → consolelib-1.0.0}/ConsoleLib.egg-info/top_level.txt +0 -0
- {consolelib-0.1.0 → consolelib-1.0.0}/setup.cfg +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import os, sys, time
|
|
2
|
+
import subprocess as CMD
|
|
3
|
+
class Render:
|
|
4
|
+
@staticmethod
|
|
5
|
+
def DrawPic(
|
|
6
|
+
points=None,
|
|
7
|
+
width=80,
|
|
8
|
+
height=25,
|
|
9
|
+
clear_before_draw=False,
|
|
10
|
+
default_char=' '
|
|
11
|
+
):
|
|
12
|
+
if clear_before_draw:
|
|
13
|
+
os.system("cls" if os.name == "nt" else "clear")
|
|
14
|
+
|
|
15
|
+
field = [[default_char for _ in range(width)] for _ in range(height)]
|
|
16
|
+
|
|
17
|
+
if points:
|
|
18
|
+
for item in points:
|
|
19
|
+
if len(item) == 3:
|
|
20
|
+
x, y, char = item
|
|
21
|
+
if 0 <= x < width and 0 <= y < height:
|
|
22
|
+
field[y][x] = char
|
|
23
|
+
|
|
24
|
+
for row in field:
|
|
25
|
+
print(''.join(row))
|
|
26
|
+
|
|
27
|
+
@staticmethod
|
|
28
|
+
def draw_line(x1, y1, x2, y2, char='#', width=80, height=25,clear_before_draw=False):
|
|
29
|
+
points = []
|
|
30
|
+
dx = abs(x2 - x1)
|
|
31
|
+
dy = abs(y2 - y1)
|
|
32
|
+
sx = 1 if x1 < x2 else -1
|
|
33
|
+
sy = 1 if y1 < y2 else -1
|
|
34
|
+
err = dx - dy
|
|
35
|
+
|
|
36
|
+
while True:
|
|
37
|
+
points.append((x1, y1, char))
|
|
38
|
+
if x1 == x2 and y1 == y2:
|
|
39
|
+
break
|
|
40
|
+
e2 = err * 2
|
|
41
|
+
if e2 > -dy:
|
|
42
|
+
err -= dy
|
|
43
|
+
x1 += sx
|
|
44
|
+
if e2 < dx:
|
|
45
|
+
err += dx
|
|
46
|
+
y1 += sy
|
|
47
|
+
Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
|
|
48
|
+
@staticmethod
|
|
49
|
+
def draw_circle(cx, cy, r, char='#', width=80, height=25,clear_before_draw=False):
|
|
50
|
+
points = []
|
|
51
|
+
for angle in range(0, 360, 5):
|
|
52
|
+
rad = angle * 3.14159 / 180
|
|
53
|
+
x = int(cx + r * cos(rad))
|
|
54
|
+
y = int(cy + r * sin(rad))
|
|
55
|
+
points.append((x, y, char))
|
|
56
|
+
Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
|
|
57
|
+
class ConsoleInfo:
|
|
58
|
+
@staticmethod
|
|
59
|
+
def GetConsole():
|
|
60
|
+
return sys.stdout
|
|
61
|
+
|
|
62
|
+
@staticmethod
|
|
63
|
+
def GetPipVer():
|
|
64
|
+
try:
|
|
65
|
+
result = CMD.run(['python', '-m', 'pip', '--version'], capture_output=True, text=True, check=True)
|
|
66
|
+
return result.stdout.strip()
|
|
67
|
+
except CMD.CalledProcessError as e:
|
|
68
|
+
return f"Error: pip not found (code {e.returncode})"
|
|
69
|
+
except FileNotFoundError:
|
|
70
|
+
return "Error: Python not installed or not in PATH"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ConsoleLib
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: The library for easy and best control on the Console.
|
|
5
5
|
Author-email: Suleiman <steal.apet@mail.ru>
|
|
6
6
|
License: MIT
|
|
@@ -14,4 +14,4 @@ The library for easy and best control on the Console.
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
pip install
|
|
17
|
+
pip install ConsoleLib
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ConsoleLib
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: The library for easy and best control on the Console.
|
|
5
5
|
Author-email: Suleiman <steal.apet@mail.ru>
|
|
6
6
|
License: MIT
|
|
@@ -14,4 +14,4 @@ The library for easy and best control on the Console.
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
pip install
|
|
17
|
+
pip install ConsoleLib
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ConsoleLib"
|
|
7
|
-
version = "
|
|
7
|
+
version = "1.0.0"
|
|
8
8
|
description = "The library for easy and best control on the Console."
|
|
9
9
|
authors = [{name = "Suleiman", email = "steal.apet@mail.ru"}]
|
|
10
10
|
readme = "README.md"
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import os, sys, time
|
|
2
|
-
import subprocess as CMD
|
|
3
|
-
|
|
4
|
-
class Render:
|
|
5
|
-
@staticmethod
|
|
6
|
-
def DrawPic(default_char="■", points=None, width=80, height=25, clear_before_draw=False):
|
|
7
|
-
if clear_before_draw:
|
|
8
|
-
os.system("cls" if os.name == "nt" else "clear")
|
|
9
|
-
if points is None:
|
|
10
|
-
raise TypeError("Did You Forget To Write In Arguments: 'points=[POINTS_HERE]'?")
|
|
11
|
-
if not isinstance(points, list):
|
|
12
|
-
raise TypeError("Supports Only List, What In List Tuple!")
|
|
13
|
-
field = [[' ' for _ in range(width)] for _ in range(height)]
|
|
14
|
-
for item in points:
|
|
15
|
-
x, y, custom_char = item
|
|
16
|
-
if 0 <= x < width and 0 <= y < height:
|
|
17
|
-
field[y][x] = custom_char
|
|
18
|
-
for row in field:
|
|
19
|
-
print(''.join(row))
|
|
20
|
-
|
|
21
|
-
class ConsoleInfo:
|
|
22
|
-
@staticmethod
|
|
23
|
-
def GetConsole():
|
|
24
|
-
return sys.stdout
|
|
25
|
-
|
|
26
|
-
@staticmethod
|
|
27
|
-
def GetPipVer():
|
|
28
|
-
try:
|
|
29
|
-
result = CMD.run(['python', '-m', 'pip', '--version'], capture_output=True, text=True, check=True)
|
|
30
|
-
return result.stdout.strip()
|
|
31
|
-
except CMD.CalledProcessError as e:
|
|
32
|
-
return f"Error: pip not found (code {e.returncode})"
|
|
33
|
-
except FileNotFoundError:
|
|
34
|
-
return "Error: Python not installed or not in PATH"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|