Skip to main content

终端画布

Project description

ConsoleCanvas用法:

0.安装

pip install ConsoleCanvas -i https://pypi.python.org/simple

0.1.终端显示cv2的img:

import consoleCanvas,cv2
img=cv2.imread("C:\\Users\\Administrator\\Desktop\\1.png")
consoleCanvas.cvShow(img)

1.先初始化对象:

import consoleCanvas
A=consoleCanvas.consoleCanvas()

2.生成画布:

A.ProduceCanvas(80,80)#创建画布

3.绘制像素点:

A.reviseCanvas([x,y],1)
#[x,y]是坐标,1是代表绘制黑色点,0是绘制白色点

4.显示画布:

A.show() #显示画布

5.清空画布:

A.ProduceCanvas(80,80)#也就是重新创建画布

6.例子

#绘制圆形
import consoleCanvas
a=10
b=10
r=10
A=consoleCanvas.consoleCanvas()#初始化
A.ProduceCanvas(21,21)#创建画布
A.reviseCanvas([0,0],1)
for x in range(a-r,a+r):
    y=int((((r**2)-(x-a)**2)**(1/2))+b)
    A.reviseCanvas([x,y],1)#绘制画布像素
for x in range(a+r,a-r,-1):
    y=int(-1*(((r**2)-(x-a)**2)**(1/2))+b)
    A.reviseCanvas([x,y],1)#绘制画布像素
A.show() #显示画布

输出:

⠁⠀⠔⠀⠀⠁⠀⠂⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠠⠃⠀⠀⠀⠀⠀⠀⠈⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠇⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠇⠀⠀⠀⠀⠀⠀⠀⠀⠨⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠇⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠈⠆⠀⠀⠀⠀⠀⠀⠠⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠑⠀⠀⠄⠀⠂⠁⠀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ConsoleCanvas-1.2.5.tar.gz (4.0 kB view details)

Uploaded Source

File details

Details for the file ConsoleCanvas-1.2.5.tar.gz.

File metadata

  • Download URL: ConsoleCanvas-1.2.5.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.3

File hashes

Hashes for ConsoleCanvas-1.2.5.tar.gz
Algorithm Hash digest
SHA256 7926a726ff62b095830b5d04120e22ad8759643463c039846d12cebcdef9da6f
MD5 775d524944d9976908bbbcfc05b7e365
BLAKE2b-256 eaa2fe4a7864fec4dd352f7b87fda3989e5700831e4b3ef2f18d72235a592e38

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page