3

I have a website where I have to take weekly screen shots of sister sites. I was wondering how this maybe done. I had obtained the code for taking screen shots but have no idea how to open up the browser at a set particular time so that the website screen shots maybe taken. I understood that I had to use crontab to schedule my tasks but how to open the browser?

My script to take screen shots is as follows

import gtk.gdk

w = gtk.gdk.get_default_root_window()
sz = w.get_size()
#print "The size of the window is %d x %d" % sz
pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,sz[0],sz[1])
pb = pb.get_from_drawable(w,w.get_colormap(),0,0,0,0,sz[0],sz[1])
if (pb != None):
    pb.save("screenshot.png","png")
 #   print "Screenshot saved to screenshot.png."
else:
 #   print "Unable to get the screenshot."

Any idea how to to open the browser via a python script?

I'm open to suggestions if this is not the right way to implement my idea.

0

1 Answer 1

4

Well it so happens that I found the answer to my question. :D

#!/usr/bin/python
import webbrowser
webbrowser.open("http://www.google.com")

Thats all it takes in a python script to open google using python. Cheers. :D

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .