Hello,

I'm doing a small program to capture screenshots.

But obviously I don't wan my GUI to be visible during the sreenshots and I want to continue to take sreenshots (with my key binding) even when the program doesn't have the main focus anymore.

I'm running Python 2.4 on Win XP Family.

Do you have an idea how I could do this ?

Thanks in advance

francois

---
import sys, os, msvcrt, Image, ImageGrab
from Tkinter import *
from os import chdir

def exitapp():
    fen1.quit()
    fen1.destroy()

i=0
def screenshot(event):
    fen1.iconify()
    global i
    print " screen !"
    i= i+1
    name = "session1picture"
    name= name + str(i)
    print name
    myscreen= ImageGrab.grab()
    myscreen.show()
    myscreen.save("C:/"+name+ '.jpeg')
    fen1.deiconify()

def invisible():
    fen1.iconify ()
   
#GUI launch
fen1=Tk()
fen1.title("Screenshots Tests")
bu11=Button(fen1, text='screenshot')
fen1.bind("s",screenshot)
#fen1.bind_all("s",screenshot)
bu11.bind("<Button-1>",screenshot)
buQuit=Button(fen1, width= 20, text='Quitter',command=exitapp)
bu12=Button(fen1, text='invisible', command=invisible)

bu11.pack()
bu12.pack()
buQuit.pack()

fen1.mainloop()

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to