How can start project with another pyton project in tkinter?

  inheritance, python, tkinter, tkinter-layout

I am new at tkinter.I have a real time emotion detection project.i called from another .py file, all of them is inside same file.Video capture part is defined cap in test.py, i call cap method and add the button.But when i run the project video capture works first and when i close the video capture tinker windows appear and when i clik the button, it doesn’t work. Where is my fault in code? I want the first tkinter windows appear and when i clik the button its start the video capture. What should i do ?

from tkinter import *
from test import cap
root = Tk()
root.title('Emotion Detection')
root.iconbitmap(r'C:UsersDo─čukanOneDriveMasa├╝st├╝EDicon.ico')
root.geometry("500x300")
def run():
    return cap
myButton = Button(root, text="calistir",command=run(), padx=50)
myButton.pack(pady=20)
root.mainloop()

Source: Python Questions

LEAVE A COMMENT