Skip to main content

Do Pixel Graphics with ascii charecters

Project description

ascii-graphics

Note to check the code goto src/asciianim.py on running code goes into full screen u can get out of the full screen by pressing f11

this is only available for windows operating systems right now (best used on windows 10)(could work on other operating systems - not tested)

we need to configure our command prompt to show us square texts or else program will give us a wroped in y direction result to do this *open command prompt *right click on top and goto defaults __goto fonts and select Raster Fonts and of font size 88 and save it__ (take a note of your previous settings cause its highly probabable that you wont like this font

install the software by using python -m pip install asciigraphics or in some systems py -m pip install asciigraphics or pip install asciigraphics

Usage :

Note: variable implies it has a default vaule

create a new python file

then first we need to import the module import asciigraphics as a

then we need to create canvas we can do that with function a.createcanvas() this creates a full screen canvas if u want to edit size and fulscreeness the arguments are a.createcanvas(width,height,bool_fullscreen)

a.draw() updates the screen a.clearbg() clear the screen

2d

a.point(x,y,color,intensity) places a point with given color and intensity at a given position

Note : intensity ranges from 0 to 68 int values color ranges from [0,0] to [15,15] int array values

a.line_2d(x1,y1,x2,y2,color,intensity,key) draws a line for given points,if key is set to true updates after drawing the line automatically if set to false we need to update it manually usefull for speed when u draw multiple lines u can update all of them at once

a.rect_2d(x1,y1,width,height,color,intensity,key) draws a rectangle with given width and height @ position x,y

a.ellipse_2d(xc, yc,rx, ry,color,intensity,key) draws a ellipse at xc,yc with radius rx,ry

a.arc_2d(x,y,r,a,color,intensity,key) draws an arc

a.scale_2d(s,color,intensity,key) scales the whole 2d space

a.transform_2d(x,y,color,intensity,key) transform the whole 2d space

a.rotate_at_2d(x,y,a,color,intensity,key) rotates the whole 2d space

a.fill(x,y,Nc,fillc,intensity,key,Pc) Nc is boder color and fillc is the fillcolor

a.text(x,y,string,color,key) puts a text at given location with warping

3d

make a 3d object in blender export it as an obj file and while exporting only tick the option triangulate faces and untick anything else to make sure this can import it

to import the obj file u can use the the function

obj = a.import_obj("(file location)..../objfile.obj")

u can draw this object with the function

a.Draw_Object(obj,at,showmesh,fillkey,key,light,camera)

this will draw the object at distance at if showmesh is set to true it will showmesh and fillkey is set to true it will fill the mesh

Note : here light and camera are of type vector3d created a by dataclass ie to change the light direction make a variable l = a.vector3d((float),(float),(float))

and hence this will draw the object

to rotate the points array we have function

a.rxa(angle,points) a.rya(angle,points) a.rza(angle,points)

to rotate points in obj variable

p = obj.p rxa(angle,p) or a.rya(angle,p) or a.rza(angle,p) obj.p = p

this will rotate points by a given angle

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

asciigraphics-0.1.1.tar.gz (81.7 kB view hashes)

Uploaded Source

Built Distribution

asciigraphics-0.1.1-py3-none-any.whl (28.0 kB view hashes)

Uploaded Python 3

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