ConsoleLib 1.3.2__tar.gz → 1.3.4__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.
@@ -1,5 +1,5 @@
1
1
  """
2
- ConsoleLib - The best Console Renderer of the Python.
2
+ ConsoleLib - The best Console Library of the Python.
3
3
  By: Suleiman
4
4
  Copyright © Suleiman 2026
5
5
  All rights are reserved.
@@ -10,10 +10,70 @@ import time
10
10
  import subprocess as CMD
11
11
  import math
12
12
  import random
13
- from typing import Optional, Iterator, List
13
+ import threading
14
+ from typing import Optional, Iterator, List, Tuple, Union
15
+
16
+ class Colors:
17
+ RESET = "\033[0m"
18
+ BOLD = "\033[1m"
19
+ DIM = "\033[2m"
20
+ ITALIC = "\033[3m"
21
+ UNDERLINE = "\033[4m"
22
+ BLINK = "\033[5m"
23
+ REVERSE = "\033[7m"
24
+ HIDDEN = "\033[8m"
25
+ STRIKE = "\033[9m"
26
+ BLACK = "\033[30m"
27
+ RED = "\033[31m"
28
+ GREEN = "\033[32m"
29
+ YELLOW = "\033[33m"
30
+ BLUE = "\033[34m"
31
+ MAGENTA = "\033[35m"
32
+ CYAN = "\033[36m"
33
+ WHITE = "\033[37m"
34
+ BRIGHT_BLACK = "\033[90m"
35
+ BRIGHT_RED = "\033[91m"
36
+ BRIGHT_GREEN = "\033[92m"
37
+ BRIGHT_YELLOW = "\033[93m"
38
+ BRIGHT_BLUE = "\033[94m"
39
+ BRIGHT_MAGENTA = "\033[95m"
40
+ BRIGHT_CYAN = "\033[96m"
41
+ BRIGHT_WHITE = "\033[97m"
42
+ BG_BLACK = "\033[40m"
43
+ BG_RED = "\033[41m"
44
+ BG_GREEN = "\033[42m"
45
+ BG_YELLOW = "\033[43m"
46
+ BG_BLUE = "\033[44m"
47
+ BG_MAGENTA = "\033[45m"
48
+ BG_CYAN = "\033[46m"
49
+ BG_WHITE = "\033[47m"
50
+ BG_BRIGHT_BLACK = "\033[100m"
51
+ BG_BRIGHT_RED = "\033[101m"
52
+ BG_BRIGHT_GREEN = "\033[102m"
53
+ BG_BRIGHT_YELLOW = "\033[103m"
54
+ BG_BRIGHT_BLUE = "\033[104m"
55
+ BG_BRIGHT_MAGENTA = "\033[105m"
56
+ BG_BRIGHT_CYAN = "\033[106m"
57
+ BG_BRIGHT_WHITE = "\033[107m"
58
+
59
+ @staticmethod
60
+ def rgb(r, g, b):
61
+ return f"\033[38;2;{r};{g};{b}m"
62
+
63
+ @staticmethod
64
+ def bg_rgb(r, g, b):
65
+ return f"\033[48;2;{r};{g};{b}m"
66
+
67
+ @staticmethod
68
+ def colorize(text, color, reset=True):
69
+ reset_code = Colors.RESET if reset else ""
70
+ return f"{color}{text}{reset_code}"
71
+
72
+
14
73
  class Animate:
15
74
  def clear_screen():
16
- os.system('cls' if os.name == 'nt' else 'clear')
75
+ os.system('cls' if os.name == 'nt' else 'clear')
76
+
17
77
  class ProgressBar:
18
78
  def __init__(
19
79
  self,
@@ -42,18 +102,18 @@ class Animate:
42
102
  self._lock = threading.Lock()
43
103
  self._finished = False
44
104
  self._cleared = False
45
-
105
+
46
106
  def update(self, increment: int = 1) -> None:
47
107
  with self._lock:
48
108
  if self._finished:
49
109
  return
50
110
  self.current = min(self.current + increment, self.total)
51
111
  self._print_bar()
52
-
112
+
53
113
  if self.current >= self.total:
54
114
  self._finished = True
55
115
  print()
56
-
116
+
57
117
  def set(self, value: int) -> None:
58
118
  with self._lock:
59
119
  if self._finished:
@@ -63,6 +123,7 @@ class Animate:
63
123
  if self.current >= self.total:
64
124
  self._finished = True
65
125
  print()
126
+
66
127
  def _print_bar(self) -> None:
67
128
  percent = self.current / self.total
68
129
  filled_len = int(self.length * percent)
@@ -77,22 +138,25 @@ class Animate:
77
138
  line = " ".join(parts)
78
139
  sys.stdout.write("\r" + line)
79
140
  sys.stdout.flush()
80
-
141
+
81
142
  def __enter__(self):
82
143
  if self.auto_clear and not self._cleared:
83
- clear_screen()
144
+ Animate.clear_screen()
84
145
  self._cleared = True
85
146
  if self.clear_delay > 0:
86
147
  time.sleep(self.clear_delay)
87
148
  return self
149
+
88
150
  def __exit__(self, exc_type, exc_val, exc_tb):
89
151
  if not self._finished:
90
152
  self._print_bar()
91
153
  print()
154
+
92
155
  def iterate(self, iterable: Iterator) -> Iterator:
93
156
  for i, item in enumerate(iterable):
94
157
  yield item
95
158
  self.update(1)
159
+
96
160
  def animate_print(
97
161
  text: str,
98
162
  delay: float = 0.05,
@@ -125,6 +189,7 @@ class Animate:
125
189
  sys.stdout.write(end)
126
190
  if flush:
127
191
  sys.stdout.flush()
192
+
128
193
  def spinning_cursor(
129
194
  message: str = "Loading",
130
195
  duration: float = 3.0,
@@ -133,7 +198,7 @@ class Animate:
133
198
  clear_before: bool = False,
134
199
  ) -> None:
135
200
  if clear_before:
136
- clear_screen()
201
+ Animate.clear_screen()
137
202
  if frames is None:
138
203
  frames = ["|", "/", "-", r"\\"]
139
204
  end_time = time.time() + duration
@@ -146,16 +211,20 @@ class Animate:
146
211
  idx += 1
147
212
  sys.stdout.write("\r" + " " * (len(message) + 3) + "\r")
148
213
  sys.stdout.flush()
214
+
149
215
  def countdown(seconds: int, message: str = "Countdown", clear_before: bool = False) -> None:
150
216
  if clear_before:
151
- clear_screen()
217
+ Animate.clear_screen()
152
218
  for remaining in range(seconds, 0, -1):
153
219
  sys.stdout.write(f"\r{message}: {remaining:2d} seconds remaining ")
154
220
  sys.stdout.flush()
155
221
  time.sleep(1)
156
222
  sys.stdout.write(f"\r{message}: 0 seconds remaining! Done!\n")
157
223
  sys.stdout.flush()
224
+
225
+
158
226
  class Render:
227
+ # ---- CORE ----
159
228
  @staticmethod
160
229
  def DrawPic(points=None, width=80, height=25, clear_before_draw=False, default_char=' '):
161
230
  if clear_before_draw:
@@ -163,15 +232,42 @@ class Render:
163
232
  field = [[default_char for _ in range(width)] for _ in range(height)]
164
233
  if points:
165
234
  for item in points:
166
- if len(item) == 3:
167
- x, y, char = item
235
+ if len(item) >= 3:
236
+ x, y, char = item[0], item[1], item[2]
168
237
  if 0 <= x < width and 0 <= y < height:
169
- field[y][x] = char
238
+ # Если есть цвет — применяем
239
+ if len(item) == 4:
240
+ color = item[3]
241
+ field[y][x] = f"{color}{char}{Colors.RESET}"
242
+ elif len(item) == 5:
243
+ color, bg = item[3], item[4]
244
+ field[y][x] = f"{color}{bg}{char}{Colors.RESET}"
245
+ else:
246
+ field[y][x] = char
170
247
  for row in field:
171
248
  print(''.join(row))
172
249
 
250
+ # ---- POINT GENERATORS WITH COLOR ----
251
+ @staticmethod
252
+ def _apply_color(points, color=None, bg=None):
253
+ if color is None and bg is None:
254
+ return points
255
+ result = []
256
+ for p in points:
257
+ if len(p) == 3:
258
+ x, y, char = p
259
+ if color and bg:
260
+ result.append((x, y, char, color, bg))
261
+ elif color:
262
+ result.append((x, y, char, color))
263
+ else:
264
+ result.append((x, y, char, Colors.BG_BLACK + bg))
265
+ else:
266
+ result.append(p)
267
+ return result
268
+
173
269
  @staticmethod
174
- def get_line_points(x1, y1, x2, y2, char='#'):
270
+ def get_line_points(x1, y1, x2, y2, char='#', color=None, bg=None):
175
271
  points = []
176
272
  dx = abs(x2 - x1)
177
273
  dy = abs(y2 - y1)
@@ -189,29 +285,29 @@ class Render:
189
285
  if e2 < dx:
190
286
  err += dx
191
287
  y1 += sy
192
- return points
288
+ return Render._apply_color(points, color, bg)
193
289
 
194
290
  @staticmethod
195
- def get_circle_points(cx, cy, r, char='#'):
291
+ def get_circle_points(cx, cy, r, char='#', color=None, bg=None):
196
292
  points = []
197
293
  for angle in range(0, 360, 5):
198
294
  rad = angle * math.pi / 180
199
295
  x = int(cx + r * math.cos(rad))
200
296
  y = int(cy + r * math.sin(rad))
201
297
  points.append((x, y, char))
202
- return points
298
+ return Render._apply_color(points, color, bg)
203
299
 
204
300
  @staticmethod
205
- def get_filled_circle_points(cx, cy, r, char='#'):
301
+ def get_filled_circle_points(cx, cy, r, char='#', color=None, bg=None):
206
302
  points = []
207
303
  for y in range(cy - r, cy + r + 1):
208
304
  for x in range(cx - r, cx + r + 1):
209
305
  if (x - cx) ** 2 + (y - cy) ** 2 <= r ** 2:
210
306
  points.append((x, y, char))
211
- return points
307
+ return Render._apply_color(points, color, bg)
212
308
 
213
309
  @staticmethod
214
- def get_rect_points(x1, y1, x2, y2, char='#'):
310
+ def get_rect_points(x1, y1, x2, y2, char='#', color=None, bg=None):
215
311
  points = []
216
312
  for x in range(x1, x2 + 1):
217
313
  points.append((x, y1, char))
@@ -219,18 +315,18 @@ class Render:
219
315
  for y in range(y1, y2 + 1):
220
316
  points.append((x1, y, char))
221
317
  points.append((x2, y, char))
222
- return points
318
+ return Render._apply_color(points, color, bg)
223
319
 
224
320
  @staticmethod
225
- def get_fill_rect_points(x1, y1, x2, y2, char='#'):
321
+ def get_fill_rect_points(x1, y1, x2, y2, char='#', color=None, bg=None):
226
322
  points = []
227
323
  for y in range(y1, y2 + 1):
228
324
  for x in range(x1, x2 + 1):
229
325
  points.append((x, y, char))
230
- return points
326
+ return Render._apply_color(points, color, bg)
231
327
 
232
328
  @staticmethod
233
- def get_text_points(x, y, text, char=None):
329
+ def get_text_points(x, y, text, char=None, color=None, bg=None):
234
330
  points = []
235
331
  if char is None:
236
332
  for i, ch in enumerate(text):
@@ -238,18 +334,18 @@ class Render:
238
334
  else:
239
335
  for i in range(len(text)):
240
336
  points.append((x + i, y, char))
241
- return points
337
+ return Render._apply_color(points, color, bg)
242
338
 
243
339
  @staticmethod
244
- def get_triangle_points(x1, y1, x2, y2, x3, y3, char='#'):
340
+ def get_triangle_points(x1, y1, x2, y2, x3, y3, char='#', color=None, bg=None):
245
341
  points = []
246
342
  points.extend(Render.get_line_points(x1, y1, x2, y2, char))
247
343
  points.extend(Render.get_line_points(x2, y2, x3, y3, char))
248
344
  points.extend(Render.get_line_points(x3, y3, x1, y1, char))
249
- return points
345
+ return Render._apply_color(points, color, bg)
250
346
 
251
347
  @staticmethod
252
- def get_filled_triangle_points(x1, y1, x2, y2, x3, y3, char='#'):
348
+ def get_filled_triangle_points(x1, y1, x2, y2, x3, y3, char='#', color=None, bg=None):
253
349
  points = []
254
350
  min_x = min(x1, x2, x3)
255
351
  max_x = max(x1, x2, x3)
@@ -259,19 +355,19 @@ class Render:
259
355
  for x in range(min_x, max_x + 1):
260
356
  if Render._point_in_triangle(x, y, x1, y1, x2, y2, x3, y3):
261
357
  points.append((x, y, char))
262
- return points
358
+ return Render._apply_color(points, color, bg)
263
359
 
264
360
  @staticmethod
265
- def get_heart_points(cx, cy, size=5, char='#'):
361
+ def get_heart_points(cx, cy, size=5, char='#', color=None, bg=None):
266
362
  points = []
267
363
  for y in range(-size, size + 1):
268
364
  for x in range(-size, size + 1):
269
365
  if ((x * x + y * y - size * size) ** 3 <= size * size * x * x * y * y * 0.5):
270
366
  points.append((cx + x, cy - y, char))
271
- return points
367
+ return Render._apply_color(points, color, bg)
272
368
 
273
369
  @staticmethod
274
- def get_star_points(cx, cy, radius=5, points_count=5, char='*'):
370
+ def get_star_points(cx, cy, radius=5, points_count=5, char='*', color=None, bg=None):
275
371
  points = []
276
372
  angle = -math.pi / 2
277
373
  step = math.pi / points_count
@@ -291,28 +387,28 @@ class Render:
291
387
  p3 = outer_points[(i + 1) % points_count]
292
388
  points.extend(Render.get_line_points(int(p1[0]), int(p1[1]), int(p2[0]), int(p2[1]), char))
293
389
  points.extend(Render.get_line_points(int(p2[0]), int(p2[1]), int(p3[0]), int(p3[1]), char))
294
- return points
390
+ return Render._apply_color(points, color, bg)
295
391
 
296
392
  @staticmethod
297
- def get_bezier_points(x1, y1, x2, y2, x3, y3, steps=20, char='#'):
393
+ def get_bezier_points(x1, y1, x2, y2, x3, y3, steps=20, char='#', color=None, bg=None):
298
394
  points = []
299
395
  for t in range(steps + 1):
300
396
  t = t / steps
301
397
  x = (1 - t) ** 2 * x1 + 2 * (1 - t) * t * x2 + t ** 2 * x3
302
398
  y = (1 - t) ** 2 * y1 + 2 * (1 - t) * t * y2 + t ** 2 * y3
303
399
  points.append((int(x), int(y), char))
304
- return points
400
+ return Render._apply_color(points, color, bg)
305
401
 
306
402
  @staticmethod
307
- def get_wave_points(cx, cy, amplitude=5, length=20, char='~'):
403
+ def get_wave_points(cx, cy, amplitude=5, length=20, char='~', color=None, bg=None):
308
404
  points = []
309
405
  for x in range(length):
310
406
  y = cy + int(amplitude * math.sin(x * 0.5))
311
407
  points.append((cx + x, y, char))
312
- return points
408
+ return Render._apply_color(points, color, bg)
313
409
 
314
410
  @staticmethod
315
- def get_spiral_points(cx, cy, turns=3, radius=10, step=0.1, char='*'):
411
+ def get_spiral_points(cx, cy, turns=3, radius=10, step=0.1, char='*', color=None, bg=None):
316
412
  points = []
317
413
  angle = 0
318
414
  r = 0
@@ -322,18 +418,18 @@ class Render:
322
418
  points.append((x, y, char))
323
419
  angle += step
324
420
  r += step * 2
325
- return points
421
+ return Render._apply_color(points, color, bg)
326
422
 
327
423
  @staticmethod
328
- def get_grid_points(x1, y1, x2, y2, step=2, char='+'):
424
+ def get_grid_points(x1, y1, x2, y2, step=2, char='+', color=None, bg=None):
329
425
  points = []
330
426
  for x in range(x1, x2 + 1, step):
331
427
  for y in range(y1, y2 + 1, step):
332
428
  points.append((x, y, char))
333
- return points
429
+ return Render._apply_color(points, color, bg)
334
430
 
335
431
  @staticmethod
336
- def get_noise_points(cx, cy, radius, count=50, char='.'):
432
+ def get_noise_points(cx, cy, radius, count=50, char='.', color=None, bg=None):
337
433
  points = []
338
434
  for _ in range(count):
339
435
  angle = random.uniform(0, 2 * math.pi)
@@ -341,8 +437,9 @@ class Render:
341
437
  x = int(cx + r * math.cos(angle))
342
438
  y = int(cy + r * math.sin(angle))
343
439
  points.append((x, y, char))
344
- return points
440
+ return Render._apply_color(points, color, bg)
345
441
 
442
+ # ---- 3D ----
346
443
  @staticmethod
347
444
  def _point_in_triangle(px, py, x1, y1, x2, y2, x3, y3):
348
445
  def sign(a, b, c):
@@ -392,7 +489,7 @@ class Render:
392
489
  return x2d, y2d
393
490
 
394
491
  @staticmethod
395
- def get_cube_3d_points(size=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#'):
492
+ def get_cube_3d_points(size=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', color=None, bg=None):
396
493
  s = size / 2
397
494
  vertices = [
398
495
  (-s, -s, -s), (s, -s, -s), (s, s, -s), (-s, s, -s),
@@ -412,10 +509,10 @@ class Render:
412
509
  x1, y1 = projected[edge[0]]
413
510
  x2, y2 = projected[edge[1]]
414
511
  points.extend(Render.get_line_points(x1, y1, x2, y2, char))
415
- return points
512
+ return Render._apply_color(points, color, bg)
416
513
 
417
514
  @staticmethod
418
- def get_pyramid_3d_points(size=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#'):
515
+ def get_pyramid_3d_points(size=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', color=None, bg=None):
419
516
  s = size / 2
420
517
  vertices = [
421
518
  (-s, -s, -s), (s, -s, -s), (s, -s, s), (-s, -s, s),
@@ -434,10 +531,10 @@ class Render:
434
531
  x1, y1 = projected[edge[0]]
435
532
  x2, y2 = projected[edge[1]]
436
533
  points.extend(Render.get_line_points(x1, y1, x2, y2, char))
437
- return points
534
+ return Render._apply_color(points, color, bg)
438
535
 
439
536
  @staticmethod
440
- def get_cylinder_3d_points(radius=5, height=10, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#'):
537
+ def get_cylinder_3d_points(radius=5, height=10, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', color=None, bg=None):
441
538
  points = []
442
539
  top_points = []
443
540
  bottom_points = []
@@ -463,10 +560,10 @@ class Render:
463
560
  x1, y1 = projected[i]
464
561
  x2, y2 = projected[i + segments]
465
562
  points.extend(Render.get_line_points(x1, y1, x2, y2, char))
466
- return points
563
+ return Render._apply_color(points, color, bg)
467
564
 
468
565
  @staticmethod
469
- def get_sphere_3d_points(radius=5, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#'):
566
+ def get_sphere_3d_points(radius=5, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', color=None, bg=None):
470
567
  points = []
471
568
  for i in range(segments):
472
569
  theta = i / segments * math.pi
@@ -477,10 +574,10 @@ class Render:
477
574
  z = radius * math.sin(theta) * math.sin(phi)
478
575
  x2d, y2d = Render._project_3d(x, y, z, rotx, roty, rotz, scale, cx, cy)
479
576
  points.append((x2d, y2d, char))
480
- return points
577
+ return Render._apply_color(points, color, bg)
481
578
 
482
579
  @staticmethod
483
- def get_cone_3d_points(radius=5, height=10, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#'):
580
+ def get_cone_3d_points(radius=5, height=10, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', color=None, bg=None):
484
581
  points = []
485
582
  base_points = []
486
583
  for i in range(segments):
@@ -502,10 +599,10 @@ class Render:
502
599
  x1, y1 = projected[i]
503
600
  x2, y2 = projected[-1]
504
601
  points.extend(Render.get_line_points(x1, y1, x2, y2, char))
505
- return points
602
+ return Render._apply_color(points, color, bg)
506
603
 
507
604
  @staticmethod
508
- def get_torus_3d_points(radius=8, tube=3, segments=16, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#'):
605
+ def get_torus_3d_points(radius=8, tube=3, segments=16, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', color=None, bg=None):
509
606
  points = []
510
607
  for i in range(segments):
511
608
  theta = i / segments * 2 * math.pi
@@ -516,10 +613,10 @@ class Render:
516
613
  z = (radius + tube * math.cos(phi)) * math.sin(theta)
517
614
  x2d, y2d = Render._project_3d(x, y, z, rotx, roty, rotz, scale, cx, cy)
518
615
  points.append((x2d, y2d, char))
519
- return points
616
+ return Render._apply_color(points, color, bg)
520
617
 
521
618
  @staticmethod
522
- def get_ico_sphere_3d_points(radius=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#'):
619
+ def get_ico_sphere_3d_points(radius=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', color=None, bg=None):
523
620
  points = []
524
621
  phi = (1 + math.sqrt(5)) / 2
525
622
  vertices = [
@@ -548,118 +645,120 @@ class Render:
548
645
  x1, y1 = projected[edge[0]]
549
646
  x2, y2 = projected[edge[1]]
550
647
  points.extend(Render.get_line_points(x1, y1, x2, y2, char))
551
- return points
648
+ return Render._apply_color(points, color, bg)
552
649
 
650
+ # ---- DRAW WRAPPERS ----
553
651
  @staticmethod
554
- def draw_cube_3d(size=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False):
555
- points = Render.get_cube_3d_points(size, rotx, roty, rotz, scale, cx, cy, char)
652
+ def draw_line(x1, y1, x2, y2, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
653
+ points = Render.get_line_points(x1, y1, x2, y2, char, color, bg)
556
654
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
557
655
 
558
656
  @staticmethod
559
- def draw_pyramid_3d(size=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False):
560
- points = Render.get_pyramid_3d_points(size, rotx, roty, rotz, scale, cx, cy, char)
657
+ def draw_circle(cx, cy, r, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
658
+ points = Render.get_circle_points(cx, cy, r, char, color, bg)
561
659
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
562
660
 
563
661
  @staticmethod
564
- def draw_cylinder_3d(radius=5, height=10, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, clear_before_draw=False):
565
- points = Render.get_cylinder_3d_points(radius, height, segments, rotx, roty, rotz, scale, cx, cy, char)
662
+ def draw_filled_circle(cx, cy, r, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
663
+ points = Render.get_filled_circle_points(cx, cy, r, char, color, bg)
566
664
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
567
665
 
568
666
  @staticmethod
569
- def draw_sphere_3d(radius=5, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False):
570
- points = Render.get_sphere_3d_points(radius, segments, rotx, roty, rotz, scale, cx, cy, char)
667
+ def draw_rect(x1, y1, x2, y2, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
668
+ points = Render.get_rect_points(x1, y1, x2, y2, char, color, bg)
571
669
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
572
670
 
573
671
  @staticmethod
574
- def draw_cone_3d(radius=5, height=10, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, clear_before_draw=False):
575
- points = Render.get_cone_3d_points(radius, height, segments, rotx, roty, rotz, scale, cx, cy, char)
672
+ def fill_rect(x1, y1, x2, y2, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
673
+ points = Render.get_fill_rect_points(x1, y1, x2, y2, char, color, bg)
576
674
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
577
675
 
578
676
  @staticmethod
579
- def draw_torus_3d(radius=8, tube=3, segments=16, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False):
580
- points = Render.get_torus_3d_points(radius, tube, segments, rotx, roty, rotz, scale, cx, cy, char)
677
+ def draw_text(x, y, text, width=80, height=25, clear_before_draw=False, color=None, bg=None):
678
+ points = Render.get_text_points(x, y, text, color=color, bg=bg)
581
679
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
582
680
 
583
681
  @staticmethod
584
- def draw_ico_sphere_3d(radius=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False):
585
- points = Render.get_ico_sphere_3d_points(radius, rotx, roty, rotz, scale, cx, cy, char)
682
+ def draw_triangle(x1, y1, x2, y2, x3, y3, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
683
+ points = Render.get_triangle_points(x1, y1, x2, y2, x3, y3, char, color, bg)
586
684
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
587
685
 
588
686
  @staticmethod
589
- def draw_line(x1, y1, x2, y2, char='#', width=80, height=25, clear_before_draw=False):
590
- points = Render.get_line_points(x1, y1, x2, y2, char)
687
+ def fill_triangle(x1, y1, x2, y2, x3, y3, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
688
+ points = Render.get_filled_triangle_points(x1, y1, x2, y2, x3, y3, char, color, bg)
591
689
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
592
690
 
593
691
  @staticmethod
594
- def draw_circle(cx, cy, r, char='#', width=80, height=25, clear_before_draw=False):
595
- points = Render.get_circle_points(cx, cy, r, char)
692
+ def draw_heart(cx, cy, size=5, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
693
+ points = Render.get_heart_points(cx, cy, size, char, color, bg)
596
694
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
597
695
 
598
696
  @staticmethod
599
- def draw_filled_circle(cx, cy, r, char='#', width=80, height=25, clear_before_draw=False):
600
- points = Render.get_filled_circle_points(cx, cy, r, char)
697
+ def draw_star(cx, cy, radius=5, points_count=5, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
698
+ points = Render.get_star_points(cx, cy, radius, points_count, char, color, bg)
601
699
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
602
700
 
603
701
  @staticmethod
604
- def draw_rect(x1, y1, x2, y2, char='#', width=80, height=25, clear_before_draw=False):
605
- points = Render.get_rect_points(x1, y1, x2, y2, char)
702
+ def draw_bezier(x1, y1, x2, y2, x3, y3, steps=20, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
703
+ points = Render.get_bezier_points(x1, y1, x2, y2, x3, y3, steps, char, color, bg)
606
704
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
607
705
 
608
706
  @staticmethod
609
- def fill_rect(x1, y1, x2, y2, char='#', width=80, height=25, clear_before_draw=False):
610
- points = Render.get_fill_rect_points(x1, y1, x2, y2, char)
707
+ def draw_wave(cx, cy, amplitude=5, length=20, char='~', width=80, height=25, clear_before_draw=False, color=None, bg=None):
708
+ points = Render.get_wave_points(cx, cy, amplitude, length, char, color, bg)
611
709
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
612
710
 
613
711
  @staticmethod
614
- def draw_text(x, y, text, width=80, height=25, clear_before_draw=False):
615
- points = Render.get_text_points(x, y, text)
712
+ def draw_spiral(cx, cy, turns=3, radius=10, step=0.1, char='*', width=80, height=25, clear_before_draw=False, color=None, bg=None):
713
+ points = Render.get_spiral_points(cx, cy, turns, radius, step, char, color, bg)
616
714
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
617
715
 
618
716
  @staticmethod
619
- def draw_triangle(x1, y1, x2, y2, x3, y3, char='#', width=80, height=25, clear_before_draw=False):
620
- points = Render.get_triangle_points(x1, y1, x2, y2, x3, y3, char)
717
+ def draw_grid(x1, y1, x2, y2, step=2, char='+', width=80, height=25, clear_before_draw=False, color=None, bg=None):
718
+ points = Render.get_grid_points(x1, y1, x2, y2, step, char, color, bg)
621
719
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
622
720
 
623
721
  @staticmethod
624
- def fill_triangle(x1, y1, x2, y2, x3, y3, char='#', width=80, height=25, clear_before_draw=False):
625
- points = Render.get_filled_triangle_points(x1, y1, x2, y2, x3, y3, char)
722
+ def draw_noise(cx, cy, radius, count=50, char='.', width=80, height=25, clear_before_draw=False, color=None, bg=None):
723
+ points = Render.get_noise_points(cx, cy, radius, count, char, color, bg)
626
724
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
627
725
 
628
726
  @staticmethod
629
- def draw_heart(cx, cy, size=5, char='#', width=80, height=25, clear_before_draw=False):
630
- points = Render.get_heart_points(cx, cy, size, char)
727
+ def draw_cube_3d(size=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
728
+ points = Render.get_cube_3d_points(size, rotx, roty, rotz, scale, cx, cy, char, color, bg)
631
729
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
632
730
 
633
731
  @staticmethod
634
- def draw_star(cx, cy, radius=5, points_count=5, char='#', width=80, height=25, clear_before_draw=False):
635
- points = Render.get_star_points(cx, cy, radius, points_count, char)
732
+ def draw_pyramid_3d(size=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
733
+ points = Render.get_pyramid_3d_points(size, rotx, roty, rotz, scale, cx, cy, char, color, bg)
636
734
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
637
735
 
638
736
  @staticmethod
639
- def draw_bezier(x1, y1, x2, y2, x3, y3, steps=20, char='#', width=80, height=25, clear_before_draw=False):
640
- points = Render.get_bezier_points(x1, y1, x2, y2, x3, y3, steps, char)
737
+ def draw_cylinder_3d(radius=5,segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
738
+ points = Render.get_cylinder_3d_points(radius, height, segments, rotx, roty, rotz, scale, cx, cy, char, color, bg)
641
739
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
642
740
 
643
741
  @staticmethod
644
- def draw_wave(cx, cy, amplitude=5, length=20, char='~', width=80, height=25, clear_before_draw=False):
645
- points = Render.get_wave_points(cx, cy, amplitude, length, char)
742
+ def draw_sphere_3d(radius=5, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
743
+ points = Render.get_sphere_3d_points(radius, segments, rotx, roty, rotz, scale, cx, cy, char, color, bg)
646
744
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
647
745
 
648
746
  @staticmethod
649
- def draw_spiral(cx, cy, turns=3, radius=10, step=0.1, char='*', width=80, height=25, clear_before_draw=False):
650
- points = Render.get_spiral_points(cx, cy, turns, radius, step, char)
747
+ def draw_cone_3d(radius=5, segments=12, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
748
+ points = Render.get_cone_3d_points(radius, height, segments, rotx, roty, rotz, scale, cx, cy, char, color, bg)
651
749
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
652
750
 
653
751
  @staticmethod
654
- def draw_grid(x1, y1, x2, y2, step=2, char='+', width=80, height=25, clear_before_draw=False):
655
- points = Render.get_grid_points(x1, y1, x2, y2, step, char)
752
+ def draw_torus_3d(radius=8, tube=3, segments=16, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
753
+ points = Render.get_torus_3d_points(radius, tube, segments, rotx, roty, rotz, scale, cx, cy, char, color, bg)
656
754
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
657
755
 
658
756
  @staticmethod
659
- def draw_noise(cx, cy, radius, count=50, char='.', width=80, height=25, clear_before_draw=False):
660
- points = Render.get_noise_points(cx, cy, radius, count, char)
757
+ def draw_ico_sphere_3d(radius=5, rotx=0, roty=0, rotz=0, scale=10, cx=40, cy=12, char='#', width=80, height=25, clear_before_draw=False, color=None, bg=None):
758
+ points = Render.get_ico_sphere_3d_points(radius, rotx, roty, rotz, scale, cx, cy, char, color, bg)
661
759
  Render.DrawPic(points=points, width=width, height=height, clear_before_draw=clear_before_draw)
662
760
 
761
+
663
762
  class ConsoleInfo:
664
763
  @staticmethod
665
764
  def GetConsole():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ConsoleLib
3
- Version: 1.3.2
3
+ Version: 1.3.4
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ConsoleLib
3
- Version: 1.3.2
3
+ Version: 1.3.4
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ConsoleLib"
7
- version = "1.3.2"
7
+ version = "1.3.4"
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"
File without changes
File without changes