can anyone here help me write a code like these graphics:http://www.cs.utk.edu/~booth/


i have been searching how to these, but i only saw you guys using turtle, python.game, etc.. i need a code for only python22 (graphics.py)
i can only do stick figures, it would be a great help if someone can write a code for me, but i will change the color or the shape of some. I know you guys are saying that you are not going to do my work, but this is all i know.

You can download the graphics.py module from:
http://mcsp.wartburg.edu/zelle/python/graphics.py

The module itself has some demo/test code in it. There is also a reference to Prof. Zelle's book that uses this module.

Here is a typical example ...

# draw a circle on top of two rectangles
# using module graphics from:
# http://mcsp.wartburg.edu/zelle/python/graphics.py

from graphics import *

# create the window/frame
w = 300
h = 300
win = GraphWin("Red Circle", w, h)

# first rectangle using corner x, y coordinates
upper_left = Point(0, 0)
lower_right = Point(300, 150)
rect1 = Rectangle(upper_left, lower_right)
rect1.setFill('yellow')
rect1.setWidth(0)  # no border
rect1.draw(win)

# second rectangle using corner x, y coordinates
upper_left = Point(0, 150)
lower_right = Point(300, 300)
rect2 = Rectangle(upper_left, lower_right)
rect2.setFill('green')
rect2.setWidth(0)  # no border
rect2.draw(win)

# circle needs center x, y coordinates and radius
center = Point(150, 150)
radius = 80
circle = Circle(center, radius)
circle.setFill('red')
circle.setWidth(2)
circle.draw(win)

# wait, click mouse to go on/exit
win.getMouse() 
win.close()

Experiment with the coordinates and colors a little.

Edited 6 Years Ago by vegaseat: code sample

This question has already been answered. Start a new discussion instead.