def find_text(event=None): search_toplevel = Tk.Toplevel(root) search_toplevel.title('Find Text') search_toplevel.transient(root) search_toplevel.resizable(False, False) Label(search_toplevel, text="Find All:").grid(row=0, column=0, sticky='e') search_entry_widget = Entry(search_toplevel, width=25) search_entry_widget.grid(row=0, column=1, padx=2, pady=2, sticky='we') search_entry_widget.focus_set() ignore_case_value = IntVar() Checkbutton(search_toplevel, text='Ignore Case', variable=ignore_case_value).grid(row=1, column=1, sticky='e', padx=2, pady=2) Button(search_toplevel, text="Find All", underline=0, command=lambda: search_output(search_entry_widget.get( ), ignore_case_value.get(), content_text, search_toplevel, search_entry_widget)).grid( row=0, column=2, sticky='e' + 'w', padx=2, pady=2) def close_search_window(): content_text.tag_remove('match', '1.0', END) search_toplevel.destroy() search_toplevel.protocol('WM_DELETE_WINDOW', close_search_window) return "break"
def restart_h_function(): if os.geteuid() != 0: print("You need to have root privileges") messagebox.showinfo("Raspberry Pi Authentication", "You need to have root privileges") sys.exit if os.geteuid() == 0: #PW function in new window window = tk.Toplevel(app) usernameLabel = Label(window, text="User Name") usernameLabel.grid(row=1, column=1, padx='0', pady='0') usernameEntry = Entry(window, textvariable=username) usernameEntry.grid(row=1, column=2, padx='0', pady='0') passwordLabel = Label(window, text="Password") passwordLabel.grid(row=2, column=1, padx='0', pady='0') passwordEntry = Entry(window, textvariable=password, show='*') passwordEntry.grid(row=2, column=2, padx='0', pady='0') #loginButton = Button(window, text="Authentication", command=validateLogin_update_os_function) #loginButton.grid(row=3, column=2, padx='0', pady='0') loginButton = Button(window, text="Authentication", command=lambda: fun(1)) loginButton.grid(row=3, column=2, padx='0', pady='0') #b2 = Button(window, text="Quit2", command=lambda: fun(2)) #b2.grid() def fun(arg): if arg == 1: #tkinter.messagebox.showinfo("button 1", "button 1 used") command = restarthornet() window.destroy()