def starttimelapse2(): no = 1 global tbp global running global picture global button global r global g global b global brightness print('Time Lapse Has Started!') ## cam.start_preview() sleep(2) cam.capture("warmup.jpg") endbutton.enable() button.disable() previewbutton.disable() if os.path.exists("/home/pi/photos/" + filename_choice.value): print("folder exits") #appwarning = Window(app, title="Warning") filenameexists = yesno("Filename already exists!", "Would you like to overwrite?") if filenameexists == True: pass else: finishtimelapse() #app.display() else: os.makedirs("/home/pi/photos/" + filename_choice.value) print("made folder") while running: picture.hide() set_motes() sleep(0.5) filename = "/home/pi/photos/" + str(filename_choice.value) + "/" + str( filename_choice.value) + str(no).zfill(4) + (".jpg") filename_choice.disable() cam.iso = 100 sleep(2) cam.shutter_speed = cam.exposure_speed cam.exposure_mode = 'off' g = cam.awb_gains cam.awb_mode = 'off' cam.awb_gains = g cam.capture(filename) print(tbp) print('Captured %s' % filename) im = Image.open(filename) im.thumbnail((240, 180), Image.ANTIALIAS) im.save('arse.png') picture = Picture(app, image="arse.png", grid=[0, 4]) picture.height = 180 picture.width = 240 picture.show() messagercounter = Text(app, text=str(no), grid=[0, 3]) no = no + 1 sleep(0.1) mote.clear() mote.show() sleep(tbp)
def previewstart(): global picture picture.hide() cam.capture("preview.jpg") im = Image.open("preview.jpg") im.thumbnail((240, 180), Image.ANTIALIAS) im.save('arse.png') picture = Picture(app, image="arse.png", grid=[0, 4]) picture.height = 180 picture.width = 240 picture.show()
# bar chart on right hand edge barChart = Waffle(control_app, height=20, width=1, pad=0, grid=[5, 1, 1, 4]) barChart.repeat(100, updateBar) # update the bar every 100ms # Push buttons #earthquake = PushButton(control_app, text="Earthquake Off", # command=change_earthquake_text, grid=[1, 1]) #earthquake.bg = 'red' #earthquake.width = 12 #earthquake.height = 3 eqOn = Picture(control_app, 'eqon.gif',grid = [1, 1]) eqOn.hide() eqOff = Picture(control_app, 'eqoff.gif', grid = [1, 1]) eqOff.show() #control = PushButton(control_app, text="Control Off", # command=change_control_text, grid=[3, 1]) #control.bg = 'red' #control.width = 12 #control.height = 3 ctrOn = Picture(control_app, 'ctrlon.gif',grid = [3, 1]) ctrOn.hide() ctrOff = Picture(control_app, 'ctrloff.gif', grid = [3, 1]) ctrOff.show() # mini = PushButton(control_app,text='Minimise',command=minimise) # mini.bg = 'orange' #infoButton = PushButton(control_app, text='i', command=info, grid=[3, 3])