2 Replies - 1219 Views - Last Post: 28 May 2013 - 09:17 PM Rate Topic: -----

#1 qbektrix  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 20-March 13

Newbie Project: Download wallpaper from Bing for Win 7

Posted 20 March 2013 - 10:17 AM

I am a newbie to Python. I just have 2yrs experience in C# Asp.net Web form.
I have gone through a couple of tutorials but I am still not sure. So, I decided to do a project as a way of learning better and I need help and guidance to get it done
My project is an application to download background image from bing.com, save it to my hard disk and make it a wallpaper in my Windows 7 machine.
The steps are:
  • Goto bing.com and get the url location of the background image.
  • Save it a specific folder in my PC
  • Make it the wallpaper in my Windows 7

I guess, a scheduler can be used to run it every 24 hrs.
Couple of project I saw on net deal with ubuntu or mac and they get the image from a RSS feed which is stopped updating now.
Where do I start from?

Is This A Good Question/Topic? 0
  • +

Replies To: Newbie Project: Download wallpaper from Bing for Win 7

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,496
  • Joined: 23-August 08

Re: Newbie Project: Download wallpaper from Bing for Win 7

Posted 20 March 2013 - 11:22 AM

You could start at BeautifulSoup
Was This Post Helpful? 0
  • +
  • -

#3 witeboy724  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 29
  • Joined: 21-June 12

Re: Newbie Project: Download wallpaper from Bing for Win 7

Posted 28 May 2013 - 09:17 PM

As I was typing out this response and looking for the best way to set wallpaper on Windows 7 I saw that you already got a pretty complete answer to this same question on a different site. So I'll go ahead and post the couple parts that I typed up so far and maybe they'll be useful to someone else.

After finding the link using your preferred method, here's a couple ways I've downloaded images in the past. Using today's Bing image path in the example.
#USING REQUESTS
import requests
f = open('IMGusingrequests.jpg','wb')
f.write(requests.get('http://www.bing.com/az/hprichbg/rb/GlacialFlows_EN-US6566955237_1366x768.jpg').content)
f.close()

#USING URLLIB
import urllib
urllib.urlretrieve('http://www.bing.com/az/hprichbg/rb/GlacialFlows_EN-US6566955237_1366x768.jpg', "IMGusingurllib.jpg")



Then the way I just found for setting Win7 wallpaper after downloading and setting variable filename to the path, (ctypes seems to be the best way)
import ctypes
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, filename , 0)


I know that XP needs the image to be a BMP (using PIL works) but I'm not sure about Windows 7 and don't have it on a running computer to test right now. After seeing that you got a good answer to this already I was a little discouraged from researching the wallpaper switching more, haha.

Maybe this will still help someone in the future.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1