Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys.I'm using tkinter for first time and I want to know if/how can I run app to do some things while I have my camera enabled.I can do it via terminal ,but how can I do it with tkinter?
For example, I want to click a button (named "Camera") to open my camera and at the same time I want to do other things without waiting (I want multitasking).
In open_camera(...) function below, I don't have while loop.
Also I want to know if mainloop() of tkinter is like while loop??
I don't know this information,so I don't use while loop in open_camera(...).
I hope I'm clear.

What I have tried:

Python
from tkinter import *
import tkinter

from camera_record import * # this is my file to open camera(do not contain while loop)
window = tkinter.Tk()
window.geometry("1300x800")
window.title("Vehicle Control")

def GUI_camera():
    open_camera(True , "")
    
Drive_button = Button(window , text = "Camera" , bg = "aqua" , width = 20 , command = GUI_camera)
Drive_button.place(x = 0 , y = 0)
Drive_button.pack()
window.mainloop()


In a few days I will teach myself tkinter by wathcing tutorials.
These days I have exams :P
Thanks in advance.
Posted
Updated 26-Jan-21 3:19am
Comments
Richard MacCutchan 26-Jan-21 9:05am    
What exactly is the problem?
Nick_is_asking 26-Jan-21 9:30am    
As I said,I have a button named "Camera" and I want to open my laptop's camera if I click this button,but I also want to do other things(for example :click another button to do something else) at the same time.When I click the "Camera" button ,a black window appears(I also use opencv).
See open_camera() function here:
https://drive.google.com/file/d/1yl5bTFSZapLrYbuODl86e65oCJEdLRGE/view?usp=sharing

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900