Hey, I am using python3 in Ubuntu20.04 for making GUI of python programs. There are approax 5 functions in otherwords 5 .py files in a complete script. I have made button against each and they are ruuing fine. Once I start calling 1 file in GUI it start running and once it ends it create trouble. How can I exit a particular function in a complete script such that rest of the tabs are not disturbed after quiting first one. I have posted code.
Best Regards
Best Regards
#!/usr/bin/env python3 import tkinter as tk import subprocess import tkinter.messagebox import os path = '/home/arooj/hacker.png' HEIGHT = 500 WIDTH = 700 root = tk.Tk() root.title("GPS JAMMER") background_image = tk.PhotoImage(file = "/home/arooj/hacker.png") label= tk.Label(image = background_image) label.pack() canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH, bg= "#2b388f") canvas.pack() frame = tk.Frame(root, bg= "#2b388f", bd=5, highlightbackground="black", highlightthickness=1) frame.place(relx=0.5, rely=0.1, relwidth=0.37, relheight=0.1, anchor='n') label = tk.Label(frame, text= "GPS Jamming Techniques", bg= "#2b388f") label.config(font=("Arial",22, 'bold')) label.place(rely=0.22, relx='0.10') lower_frame = tk.Frame(root, bg= '#2b388f', bd='10', highlightbackground="black", highlightthickness=1) lower_frame.place(relx=0.47, rely=0.34, relwidth=0.25, relheight=0.08, anchor='n') def change_color(): current_color = button.cget("background") next_color = "blue" if current_color == "#5d6d7e" else "#5d6d7e" button.config(background=next_color) root.after(1000, change_color) def run(): subprocess.call('./barrage.py', shell=True) button = tk.Button(lower_frame, text= "Start", bg= "#2b388f", fg= "white", command= run) button.place(height='27', width='55', relx='0.80', rely='0.17') change_color() label = tk.Label(lower_frame, text= "Barrage Jammer", bg= "#2b388f") label.config(font=("Comic Sans",12, 'bold')) label.place(rely=0.2, relx='0.01') lower_frame1 = tk.Frame(root, bg= '#2b388f', bd='10', highlightbackground="blue", highlightthickness=1) lower_frame1.place(relx=0.45, rely=0.23, relwidth=0.25, relheight=0.07, anchor='n') label = tk.Label(lower_frame1, text= "Click to choose GPS Jammer ", bg= "#2b388f") label.config(font=("Comic Sans",12, 'bold')) label.place(rely=0.20, relx='0.02') lower_frame = tk.Frame(root, bg= '#2b388f', bd='10', highlightbackground="black", highlightthickness=1) lower_frame.place(relx=0.47, rely=0.45, relwidth=0.25, relheight=0.08, anchor='n') def change_color(): current_color = button.cget("background") next_color = "blue" if current_color == "#5d6d7e" else "#5d6d7e" button.config(background=next_color) root.after(1000, change_color) def run(): subprocess.call('./tone_block.py', shell=True) button = tk.Button(lower_frame, text= "Start", bg= "#2b388f", fg= "white", command= run) button.place(height='27', width='55', relx='0.80', rely='0.17') change_color() label = tk.Label(lower_frame, text= "Tone Jammer", bg= "#2b388f") label.config(font=("Comic Sans",12, 'bold')) label.place(rely=0.2, relx='0.01') lower_frame = tk.Frame(root, bg= '#2b388f', bd='10', highlightbackground="black", highlightthickness=1) lower_frame.place(relx=0.47, rely=0.56, relwidth=0.25, relheight=0.08, anchor='n') def change_color(): current_color = button.cget("background") next_color = "blue" if current_color == "#5d6d7e" else "#5d6d7e" button.config(background=next_color) root.after(1000, change_color) def run(): subprocess.call('./Successive.py', shell=True) button = tk.Button(lower_frame, text= "Start", bg= "#2b388f", fg= "white", command= run) button.place(height='27', width='55', relx='0.80', rely='0.17') change_color() label = tk.Label(lower_frame, text= "Successive Pulse Jammer", bg= "#2b388f") label.config(font=("Comic Sans",12, 'bold')) label.place(rely=0.2, relx='0.01') lower_frame = tk.Frame(root, bg= '#2b388f', bd='10', highlightbackground="black", highlightthickness=1) lower_frame.place(relx=0.47, rely=0.67, relwidth=0.25, relheight=0.08, anchor='n') def change_color(): current_color = button.cget("background") next_color = "blue" if current_color == "#5d6d7e" else "#5d6d7e" button.config(background=next_color) root.after(1000, change_color) def run(): subprocess.call('./protocol.py', shell=True) button = tk.Button(lower_frame, text= "Start", bg= "#2b388f", fg= "white", command= run) button.place(height='27', width='55', relx='0.80', rely='0.17') change_color() label = tk.Label(lower_frame, text= "Protocol Aware Jammer", bg= "#2b388f") label.config(font=("Comic Sans",12, 'bold')) label.place(rely=0.2, relx='0.01') root.mainloop()