Ejemplo n.º 1
0
mc.player.setPos(-18, 1, 60.5)
mc.events.clearAll()
i = 0
prevOn = False

# Main loop
while True:
    # Look for specific events
    png = ".png"
    e = mc.events.pollBlockHits()
    if len(e) != 0:
        p = e[0].pos
        # Move the sample stage down
        if p.x == -34 and p.y == 1 and p.z == 63:
            mc.events.clearAll()
            focus.down()
            # Capture an image from the picamera.
        if p.x == -34 and p.y == 1 and p.z == 61:
            # Verify if the preview window is on.
            if prevOn:
                c.stop_preview()
                c.close()
                prevOn = False
                focus.off()
            mc.postToChat("Picture taken")
            mc.events.clearAll()
            focus.on()
            c = cam.PiCamera()
            c.capture(str(i) + png)
            c.close()
            focus.off()
                nDn = u''
		if indexDn < len(tweet):
			try:
                		while tweet[indexDn] != u' ':
                        		nDn = nDn+tweet[indexDn]
                        		indexDn = indexDn+1
                        		if indexDn > len(tweet)-1:
                                		break
			except IndexError,TypeError:
				nDn = 1
                if nDn == u'':
			nDn = 1
		else:
			nDn = int(nDn)
		
		down(nDn)
		c = picamera.PiCamera()
		s(1)
        	c.capture(ti+'.png')
       		c.close()
		off()


	
	if (u'dofocus' in tweet):
		fonT = imgF.truetype('/usr/share/fonts/truetype/freefont/FreeSansBold.ttf',30)
		imgArray = []
		indexF = tweet.index('dofocus')+8
		nFocus = u''
		if indexF < len(tweet):
			try: