commit 29c697e3b3810867bd5ace823c361e7b3430d9e6 Author: James Devine Date: Sun Aug 26 10:50:50 2018 +0200 diff --git a/Pybooth.py b/Pybooth.py new file mode 100644 index 0000000..314424f --- /dev/null +++ b/Pybooth.py @@ -0,0 +1,70 @@ +#modified All Seeing Pi to remove overlay and overlay button. +from picamera import PiCamera +#from gpiozero import Button +#from overlay_functions import * +from time import gmtime, strftime +from guizero import App, PushButton, Text, Picture +#from twython import Twython +#from auth import ( +# consumer_key, +# consumer_secret, +# access_token, +# access_token_secret +#) + +# Tell the next overlay button what to do +#def next_overlay(): +# global overlay +# overlay = next(all_overlays) +# preview_overlay(camera, overlay) + +# Tell the take picture button what to do +def take_picture(): + global output + output = strftime("/home/pi/allseeingpi/image-%d-%m %H:%M.png", gmtime()) + camera.capture(output) + camera.stop_preview() + remove_overlays(camera) +# output_overlay(output) + + # Save a smaller gif + size = 320, 200 + gif_img = Image.open(output) + gif_img.thumbnail(size, Image.ANTIALIAS) + gif_img.save(latest_photo, 'gif') + + # Set the gui picture to this picture + your_pic.set(latest_photo) + + +def new_picture(): + camera.start_preview(alpha=128) +# preview_overlay(camera, overlay) + + +# Set up buttons +#next_overlay_btn = Button(23) +#next_overlay_btn.when_pressed = next_overlay +take_pic_btn = Button(21) +take_pic_btn.when_pressed = take_picture + +# Set up camera (with resolution of the touchscreen) +camera = PiCamera() +camera.resolution = (1024, 768) +camera.hflip = True + +# Start camera preview +camera.start_preview(alpha=128) + +# Set up filename +output = "" + +latest_photo = '/home/pi/allseeingpi/latest.gif' + +app = App("The All Seeing Pi", 320, 480) +#app.attributes("-fullscreen", True) +message = Text(app, "I spotted you!") +your_pic = Picture(app, latest_photo) +new_pic = PushButton(app, new_picture, text="New picture") +tweet_pic = PushButton(app, send_tweet, text="Print picture") +app.display() \ No newline at end of file