라즈베리파이에서 GUI 프로그래밍을 실습한다.
[tk_playVedio.py]
# tk_playVedio.py
import picamera
import time
import tkinter as tk
from tkinter import ttk
win = tk.Tk()
win.title('RaspberryPI GUI ')
def playVedio():
camera = picamera.PiCamera()
camera.resolution = (300, 400)
camera.start_preview()
fileName = it.get()
camera.start_recording(output = fileName + '.h264')
recodingTime = int(co.get())
print(fileName + '.h264'))
camera.wait_recording(recodingTime)
camera.stop_preview()
camera.stop_recording()
camera.close()
ttk.Label(win, text='Fine Name: ').grid(column=0, row=0)
ttk.Label(win, text='Recoding Time: ').grid(column=0, row=1)
ttk.Label(win, text='sec').grid(column=2, row=1)
it = tk.StringVar()
tx = ttk.Entry(win, width=12, textvariable=it)
tx.grid(column=1, row=0)
num = tk.StringVar()
co = ttk.Combobox(win, width=12, textvariable=num)
co.grid(column=1, row=1)
co['values'] = (1, 2, 4, 8)
bt = ttk.Button(win, text='Start', command=playVedio)
bt.grid(column=2, row=0)
win.mainloop()
$ python3 tk_playVedio.py
[참조]
'찐s > Raspberry Pi' 카테고리의 다른 글
[RPi] Lab.06-2: Install OpenCV (pip) (0) | 2021.10.31 |
---|---|
[RPi] Lab.06-1: Install OpenCV (0) | 2021.10.23 |
[RPi] Lab.05-5: GUI (tkinter) (0) | 2021.10.03 |
[RPi] Lab.05-4: GUI (tkinter) (0) | 2021.09.25 |