Back

Explore Courses Blog Tutorials Interview Questions
0 votes
5 views
in Python by (16.4k points)

I'm making a simulation in python that needs representation (Visualization). I'm searching for the most basic illustrations library python has. Is there whatever can allow me to accomplish something in accordance with:

setWindow(10,10)

setCube(0,0,1,1,1)#windowX, windowY, width, length, hight,

updateList = simUpdate

for update in updateList:

    removeShape(0,0)

    setCube(0,0,1,1,1)

Is there whatever straightforward? 3d is definitely not an unquestionable requirement however it would be decent. I'm working in Python 3.3 and pygames hasn't been refreshed for that on a mac as should be obvious. I've been working with tkinter yet might want something somewhat simpler.

1 Answer

0 votes
by (26.4k points)

For basic graphics, you can utilize graphics.py

It's excluded with Python, so you should save it as a Python record (ideally named graphics.py) where Python can see it - on your sys.path

Note: it is additionally accessible utilizing pip install graphics.py

Example utilizing graphics.py

from graphics import *

win = GraphWin(width = 200, height = 200) # create a window

win.setCoords(0, 0, 10, 10) # set the coordinates of the window; bottom left is (0, 0) and top right is (10, 10)

mySquare = Rectangle(Point(1, 1), Point(9, 9)) # create a rectangle from (1, 1) to (9, 9)

mySquare.draw(win) # draw it to the window

win.getMouse() # pause before closing

Join the python online course fast, to learn python concepts in detail and get certified.

Browse Categories

...