I'm new to python coding with Raspberry Pi and using Tkinter (a GUI) and trying to create a script with a toggle button to close two other python processes. I used subprocesses as seen in the toggle button code but I do not know how to use subprocesses to kill processes from other scripts.
The code for my push button is
import tkinter as tk #brings in tkinter GUI for use
import subprocesses
win = tk.Tk() # Creates the GUI window
win.geometry("300x300") # Sets size for the GUI window
def close() # Close button function
subprocess.Pclose(["python", 'tk1.py']) # tk1.py is the other python file containing a process
subprocess.Pclose(["python", 'tk2.py']) # tk2.py is the other python file containing a process
win.destroy()
STOPButton = tk.Button(win, text = 'STOP',command=close,bg='red',height=1, width =6)
STOPButton.place(relx=0.11, rely=0.19)
Once, I run the code, python does not recognize the "Pclose". I'm not sure what other solutions are out there to solve this problem. Any help would be appreciated.
I'm coding in python to create a python script to close two other python scripts. I've tried the command: subprocess. But there was no success. Would anyone know how to solve this problem?
And yes it is to KILL THE PROCESSES from the scripts by using another python script to control the kill process. And it is RASPIAN