473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How can i import pictures from a web page to my Tkinter GUI?

Elias Alhanatis
Hello everybody!!!

I need some help with the following task:
I want to embed an image(gif) from a web page ( which is dynamicaly updated in that page which means i cannot download it just once...), in my GUI. I need this to happen only when a user "starts" my program .
So , how can i "get" the image from the web page and have it as an object in my program?
I am working on Windows Vista , Python 2.5.

Thank you all in advance!!!!!!

P.S.: In order to be more precice , the image i want is this:
http://www.kitconet.com/charts/metals/gold/t24_au_en_eukg_2.gif
Its a chart of the value of gold in the last 24 hours....
Oct 17 '07 #1
2 1643
ilikepython
844 Expert 512MB
Hello everybody!!!

I need some help with the following task:
I want to embed an image(gif) from a web page ( which is dynamicaly updated in that page which means i cannot download it just once...), in my GUI. I need this to happen only when a user "starts" my program .
So , how can i "get" the image from the web page and have it as an object in my program?
I am working on Windows Vista , Python 2.5.

Thank you all in advance!!!!!!

P.S.: In order to be more precice , the image i want is this:
http://www.kitconet.com/charts/metals/gold/t24_au_en_eukg_2.gif
Its a chart of the value of gold in the last 24 hours....
You could do something like this:
Expand|Select|Wrap|Line Numbers
  1. import urllib
  2.  
  3. pg = urllib.urlopen("http://www.kitconet.com/charts/metals/gold/t24_au_en_eukg_2.gif")
  4. data = pg.read()
  5.  
  6. f = open("myGoldPic.gif", "wb")
  7. f.write(data)
  8. f.close()
  9.  
And then you can use myGoldPic.gif as your image file.
Oct 20 '07 #2
That in deed does the job!!!!
Thank you so much!!!
( I went through almost all the Python tutorials i have and didn't find any piece
of code as simple as that.... and also i think that now i can understand the
mechanism used for downloading through Python). Thanks again!!!!
Oct 22 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Jay O'Connor | last post by:
Is there a good way to import python files without executing their content? I'm trying some relfection based stuff and I want to be able to import a module dynamically to check it's contents...
4
by: Kersten | last post by:
Hi to all, I havea big DB with information and pictures of our employees and this DB is used by a lot of people in our company. The data format is Access2000. In the past the import of pictures...
1
by: slomo | last post by:
I'm working on linux Fedora Core 3 with Python 2.3. I can't "from Tkinter import *" . And see only "No modlue named Tkiner" error. Of course I have tk/tcl 8.4. They works perfectly. Certainly, I...
8
by: John Salerno | last post by:
Hi all. Quick question (but aren't they all?) :) Do you think it's a good idea to use the 'from <name> import *' statement when using a GUI module? It seems on wxPython's site, they recommend...
5
by: W. Watson | last post by:
Is there a single source that explains these statements? ------------------------------ from Tkinter import * from Numeric import * import Image import ImageChops import ImageTk import time...
3
by: notnorwegian | last post by:
import Tkinter from Tkinter import * i have a program where if i comment out either of those import- statements i get an error. i thought they meant the same thing and from was supposed to be...
5
by: Alexnb | last post by:
Hello I am sure most of you are familiar with py2exe. I am having a bit of a problem. See the program has a few pictures involved and the .ico it uses for the windows. However, the pictures are...
1
by: Pierre Dagenais | last post by:
from Tkinter import * win = Tk() If I type those two lines at the command prompt (in WindowsXP) I get a new window on my screen. Yet if I copy those lines in a file called test.py and then...
5
by: Reckoner | last post by:
I have multiple packages that have many of the same function names. Is it possible to do from package1 import * from package2 import * without overwriting similarly named objects from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.