Python Forum
main lop in python tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
main lop in python tkinter
#1
I have some code like this in my tk program..
       root = tk.Tk()

     # (code like entry boxes, labels, functions, etc.)

      root.mainloop()     # the last statement
Specifically I want to continually display my webcam and also to be able to use the buttons, labels, and etc.

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()
 
    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
 
    # Display the resulting frame
    cv2.imshow('frame',gray)
    if cv2.waitKey(1) ==27:
        break
1. What is the function of root.mainloop() ? Is this a never ending loop?
2. How do I insert the other code in this loop that gets called repeatedly?
buran write Jan-23-2022, 05:41 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply


Messages In This Thread
main lop in python tkinter - by barryjo - Jan-23-2022, 04:57 PM
RE: main lop in python tkinter - by menator01 - Jan-23-2022, 06:19 PM
RE: main lop in python tkinter - by BashBedlam - Jan-23-2022, 09:36 PM
RE: main lop in python tkinter - by barryjo - Jan-23-2022, 11:50 PM
RE: main lop in python tkinter - by menator01 - Jan-23-2022, 11:55 PM
RE: main lop in python tkinter - by barryjo - Jan-24-2022, 01:25 AM
RE: main lop in python tkinter - by deanhystad - Jan-24-2022, 03:09 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  "tkinter.TclError: NULL main window" Rama02 1 5,906 Feb-04-2021, 06:45 PM
Last Post: deanhystad
  “main thread is not in main loop” in Tkinter Long_r 1 24,377 Jun-26-2019, 11:00 PM
Last Post: metulburr
  GTK main window calling a main window DennisT 4 6,891 Oct-19-2016, 09:36 PM
Last Post: DennisT

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020