tkinter e delete 280 2cend 29

Solutions on MaxInterview for tkinter e delete 280 2cend 29 by the best coders in the world

showing results for - "tkinter e delete 280 2cend 29"
Camilla
13 Oct 2020
1## CLear a TKinter box
2import tkinter as tk
3
4class App(tk.Frame):
5    def __init__(self, master):
6        tk.Frame.__init__(self, master, height=42, width=42)
7        self.entry = tk.Entry(self)
8        self.entry.focus()
9        self.entry.pack()
10        self.clear_button = tk.Button(self, text="Clear text", command=self.clear_text)
11        self.clear_button.pack()
12
13    def clear_text(self):
14        self.entry.delete(0, 'end')
15
16def main():
17    root = tk.Tk()
18    App(root).pack(expand=True, fill='both')
19    root.mainloop()
20
21if __name__ == "__main__":
22    main()