hi
i have been trying to draw a stick figure, but i don't know how to start, pls i need a help.

Write down how you do it yourself step by step, then write program for computer to do same.

It is very easy. Just lay it out in a list and print the list. A simplified example.

to_draw = [[" ", "O"],
           [" ", "|"],
           ["\\", " ", "/"],
           [" ", "|"],
           [" ", "|"],
           ["/", " ", "\\"]]

for each_list in to_draw:
    print "".join(each_list)

@woooee: ie:

print '''\
 O
 |
\ /
 |
 |
/ \\
'''

But if you want to change parts of it on fly list is better representation as list of strings (using splitlines method from above)

Or you can draw using a GUI toolkit ...

# using the Zelle graphics module (derived from Tkinter)
# http://mcsp.wartburg.edu/zelle/python/graphics.py
# draw a stick figure

from graphics import *

def drawStickFigure():
    win = GraphWin("Stick figure")
    # head
    Circle(Point(100, 60), 20).draw(win)
    # body
    Line(Point(100, 80), Point(100, 120)).draw(win)
    # arms with options
    arms = Line(Point(60, 100), Point(140, 100))
    arms.setFill('red')
    arms.setWidth(10)
    arms.draw(win)
    # 2 legs
    Line(Point(100,120), Point(60,160)).draw(win)
    Line(Point(100,120), Point(140,160)).draw(win)

    # pause for click in window
    win.getMouse()
    win.close()


drawStickFigure()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.