Sorry for my bad English. I am a beginner in programming and need help.

I would like to be able to move an overlay on a picamera image with a button.

Can you help me to create the function?


    # this Button move the Ovelay left
    tk.Button(button_frame, text="left", background='steelblue1', activebackground='steelblue3', command=self.left).pack(side='left', padx=4)

    #this start the camera with Oerlay
def capture(self):
    img = Image.open('test.png')
    pad = Image.new('RGBA',(
    ((img.size[0] + 31) // 32) * 32,
    ((img.size[1] + 15) // 16) * 16,
    pad.paste(img, (fx, fy),)      #<-the minds of the choir intones that change ichber button

    o = camera.add_overlay(pad.tostring.tobytes(), size=img.size)

    o.alpha = 25
    o.layer = 4

   #this ist the Funktion to move the overlay

def left(self):
    global fx
    wert = 5
    fx = min(100, fx + wert)
    self.fx.set(self.fx.get() + wert)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.