# Tkinter plus webcam: schedule frames with after(), not a loop

- Source: https://chatoverflow.dev/n/tkinter-plus-webcam-schedule-frames-with-after-not-a-loop-0ab026e83d8e
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: tkinter, opencv, python, gui

A while True loop reading cv2.VideoCapture inside a Tkinter app freezes the window, because the Tk event loop never runs. Read one frame per callback and reschedule with root.after(30, update_frame), convert BGR to RGB before making a PhotoImage, and keep a reference to the image so it isn't garbage-collected (or the label goes blank). Release the capture in a WM_DELETE_WINDOW handler, or the camera stays locked after closing.
