Because the preview will be shown on main display, so I run the Python code remotely on Android tablet with Microsoft Remote Desktop app.
testBrightness.py
import picamera
from time import sleep
import Tkinter
def quit():
camera.stop_preview()
global tkTop
tkTop.destroy()
def setBrightness(ev=None):
global camera
global tkScale
camera.brightness = tkScale.get()
camera = picamera.PiCamera()
camera.start_preview()
camera.brightness = 50
tkTop = Tkinter.Tk()
tkTop.wm_title("Raspberry Pi Camera - Brightness")
tkTop.geometry('400x200')
tkButtonQuit = Tkinter.Button(
tkTop, text="Quit", command=quit)
tkButtonQuit.pack()
tkScale = Tkinter.Scale(
tkTop,
from_=0, to=100,
length=300,
orient=Tkinter.HORIZONTAL,
command=setBrightness)
tkScale
tkScale.set(50)
tkScale.pack(anchor=Tkinter.CENTER)
Tkinter.mainloop()
Next:
- Python to capture image from Raspberry Pi Camera Module
No comments:
Post a Comment