hi,
I am trying to get an image with my python application output.
please give me that process.

Recommended Answers

All 7 Replies

Can you please post a smart question? You included no details about this "python application output" or anything about your program as it is. Then maybe I'll help.

Here is a Python output with an image:

# draw a flower with module turtle

import turtle as tu

tu.title('I call this one Flower')

# values for speed are 'fastest' (no delay), 'fast', (delay 5ms),
# 'normal' (delay 10ms), 'slow' (delay 15ms), and 'slowest' (delay 20ms)
tu.speed('fastest')

#turtle.color((.3,.5,.3))
tu.color('red')
tu.width(2)

radius = 180  # size of circle --> length of petal
extent = 70   # number of degrees in arc --> width of petal
angle = 0     # start out with a horizontal petal
x1 = 0        # location in X direction
y1 = -20      # location in Y direction

def flower():
    tu.up()
    tu.goto(x1,y1)
    tu.setheading(angle)
    tu.left(extent/2)
    tu.down()

    tu.circle(-radius, extent)
    tu.up()
    tu.goto(x1,y1)
    tu.down()
    tu.setheading(angle)
    tu.right(extent/2)
    # fills half the flower petal
    tu.begin_fill()
    tu.circle(radius, extent)
    tu.end_fill()

    tu.up()
    tu.goto(x1,y1)
    tu.setheading(angle)
    tu.down()

for angle in range(-45, 135, 45):
    radius = radius + 20
    flower()

for angle in range(135, 270, 45):
    radius = radius - 20
    flower()

tu.color('blue')
tu.up()
tu.goto(-60, -170)
tu.write("Fowers are beautiful!")

tu.up()
tu.setheading(90)
tu.goto(0, -15)

# keep showing until corner x is clicked
tu.done()

Here is an example that actually creates a jpeg image file of your labor:

# drawing with PIL (Python Image Library)
# draw and save a small French flag (blue, white, red)

from PIL import Image, ImageDraw

# create a new 24x16 pixel image surface (default is black bg)
img = Image.new("RGB", (24, 16))

# set up the new image surface for drawing
draw = ImageDraw.Draw (img)

# draw a blue rectangle
# x1, y1 are upper left corner coordinates here
w = 8
h = 16
x1 = 0
y1 = 0
draw.polygon([(x1,y1),
(x1+w,y1), (x1+w,y1+h), (x1,y1+h)], fill='blue')

# draw a white rectangle
w = 8
h = 16
x1 = 8
y1 = 0
draw.polygon([(x1,y1),
(x1+w,y1), (x1+w,y1+h), (x1,y1+h)], fill='white')

# draw a red rectangle
w = 8
h = 16
x1 = 16
y1 = 0
draw.polygon([(x1,y1),
(x1+w,y1), (x1+w,y1+h), (x1,y1+h)], fill='red')

img.save("french_flag.jpg")

# optionally look at the image you have drawn
img.show()

Thank you very much sneekula. I got some useful information from the code which you have sent to me. I understood some thing about PIL(Python Image Library).
But , i have developed a login screen by using Tkinter which has user name and password as text fields and one login button. After that i have developed some screens which are in navigation process. Now i want to place a particular logo which is a .jpg file on every screen top left corner. Is there any solution? Can we reach this target with this PIL module? Please give me a valuable reply..

There should be some sort of static bitmap within Tkinter that you can place on these screens (if they are, in fact, Tkinter windows).

I am also using Pmw to develop my screens. is it possible to get .jpg with output...

Here is a Python output with an image:

# draw a flower with module turtle

import turtle as tu

tu.title('I call this one Flower')

heh heh, that's awesome. The doc page for the turtle module:

http://docs.python.org/library/turtle.html

My C++ teacher had made a similar thing for Beginning programming called "Athlete"

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.