Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Exercise Example 56

Python Exercise Example 56

Python 100 Examples Python 100 Examples

**Problem:** Draw graphics; learn to use circle to draw a circle.

**Analysis:** None.

Program source code:

Example (Python 2.0+)

#!/usr/bin/python

-- coding: UTF-8 --

if

name

==

'

main

'

:

from

Tkinter

import

canvas

=

Canvas

(

width

=

800

,

height

=

600

,

bg

=

'

yellow

'

)

canvas

.

pack

(

expand

=

YES

,

fill

=

BOTH

)

k

=

1

j

=

1

for

i

in

range

(

0

,

26

)

:

canvas

.

create_oval

(

310

k

,

250

k

,

310

k

,

250

k

,

width

=

1

)

k

+=

j

j

+=

0.3

mainloop

(

)

The output of the above example is:

Python 100 Examples Python 100 Examples