1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#!/usr/bin/python
import RPi.GPIO as GPIO, time, os, subprocess
from Tkinter import *
#On mets une fenetre pour tester
fenetre = Tk() #on instancie l'objet a partir de la bibliotheque Tk
label = LabelFrame(fenetre, text="Pouet Pouet") #on definit le texte qu'on voudra dedans
label.pack() #on l'active
Button(fenetre, text="Video maggle").pack(side=RIGHT, padx=5, pady=5)
Button(fenetre, text="Photos maggle", command=snap()).pack(side=LEFT, padx=5, pady=5)
bouton = Button(fenetre, text="quitter cette super fenetre", command=fenetre.quit) #definit un bouton quit dans la fenetre
bouton.pack(side=BOTTOM) #on l'active
fenetre.mainloop()
def snap():
snap = 0
while snap < 4:
print("pose!")
time.sleep(1.5)
print("SNAP")
gpout = subprocess.check_output("gphoto2 --capture-image-and-download --filename /home/pi/photobooth_images/photobooth%H%M%S.jpg", stderr=subprocess.STDOUT, shell=True)
print(gpout)
if "ERROR" not in gpout:
snap += 1
time.sleep(0.5)
print("please wait while your photos print...")
# build image and send to printer
subprocess.call("sudo /home/pi/scripts/photobooth/assemble_and_print", shell=True)
# Wait to ensure that print queue doesn't pile up
#time.sleep(110)
print("ready for next round")
return; |
Partager