Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6963211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:45:36+00:00 2026-05-27T15:45:36+00:00

I’m working with the python graphics module. What I am trying to do is

  • 0

I’m working with the python graphics module. What I am trying to do is save the current window as an image. In the module there is an option to save an “image” as an image (image.save()). But that isn’t helpful because it just saves an image you have already loaded. OR if you load a blank image like I did in hopes drawing over it would change that, surprise, surprise: you get a blank image saved. Here is my code:

from graphics import *


w = 300
h = 300

anchorpoint=Point(150,150)
height=300
width=300

image=Image(anchorpoint, height, width) #creates a blank image in the background

win = GraphWin("Red Circle", w, h)
# 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)
point= circle.getCenter()

print point
pointx= point.getX()
pointy= point.getY()
print pointx
print pointy

findPixel=image.getPixel(150,150)
print findPixel
image.save("blank.gif")

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

#######that's it#####

so again here is my problem: How do I save what is now on the screen as “blank.gif”
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:45:36+00:00Added an answer on May 27, 2026 at 3:45 pm

    The objects you are drawing are based on Tkinter. I don’t believe you are actually drawing on the base image, but rather simply creating Tkinter objects by using the “graphics” library. I also don’t believe you can save a Tkinter to a “gif” file, though you can definitely save them in postscript format, then covert them to a gif format.

    In order to do this, you will need python’s PIL library.

    If all of your objects are actually TKinter objeccts, you can simply save the objects.

    Start by replacing this line of code:

    image.save("blank.gif")
    

    With the following:

    # saves the current TKinter object in postscript format
    win.postscript(file="image.eps", colormode='color')
    
    # Convert from eps format to gif format using PIL
    from PIL import Image as NewImage
    img = NewImage.open("image.eps")
    img.save("blank.gif", "gif")
    

    If you need additional information, please check out http://www.daniweb.com/software-development/python/code/216929 – which is where I got the suggested code.

    I’m sure there are more elegant solutions available than save/convert, but since I don’t know a lot about TKinter – this is the only way I’ve found.

    Hope it helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.