delete(0, END) doesent work for me : delete(0, END) Does not work for some reason. It does not give any error codes and the rest of the code seems fine. The delete(0, END) wont delete the 0's i get in my entry boxes from the intvar and i cant figure out why it wont work. im using delete in another code and it works there. Could any one help me out?

here is my code.

    import tkinter as tk
    from tkinter import ttk
    import io
    from tkinter import filedialog
    E=tk.E
    W=tk.W
    N=tk.N
    S=tk.S
    VERTICAL=tk.VERTICAL
    END=tk.END
    
    
    class Demo1(tk.Frame):
        def __init__(self, master):
            tk.Frame.__init__(self, master)
            self.master = master
            self.Frame = tk.Frame(self.master, borderwidth=10)
            self.Frame.grid(column=0, row=0, sticky=(N, W, E, S))
    
            button1 = tk.Button(self.Frame, text="Special Rk märkning",  command=self.new_window, width = 25)
            button1.grid(column=0, row=0, sticky=(W, E), columnspan=4)
            button2 = tk.Button(self.Frame, text="Billerud kabelmärkningar",  command=self.new_window, width = 25)
            button2.grid(column=0, row=1, sticky=(W, E), columnspan=4)   
            
    
    
        def new_window(self):
            Billerud(self)
    
    class Billerud:
        def __init__(self, master):
            self.master = master
            top1 = tk.Toplevel()
            top1.title("Billerud")
            top1.resizable(width=False, height=False)
            #fönster designern här bästems fönster ramar, rader och columner
            Frame1 = tk.Frame(top1)
            Frame1.grid(column=1, row=0, sticky=(N, W, E, S), padx=5, pady=5)
            Frame1.columnconfigure(0, weight=1)
            Frame1.rowconfigure(0, weight=1)
            #Koden är en del av entry's endast nummer restriktion
            vcmd = (Frame1.register(self.validate),
                 '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W')
            
            #create text editor
            self.text_entry = tk.Text(Frame1, width=25,height=20) 
            self.text_entry.grid(column=0, row=0, sticky=(W, E))
            scrollbar = tk.Scrollbar(Frame1, orient=VERTICAL)
            scrollbar.grid(column=0, row=0,  sticky=(N, E, S))
    
            # koppla ihop listbox med scrollbar
            self.text_entry.config(yscrollcommand=scrollbar.set)
            scrollbar.config(command=self.text_entry.yview)
            
            self.a1 = tk.StringVar()
            self.a2 = tk.StringVar()
            self.a3 = tk.IntVar()
            self.a4 = tk.StringVar()
            self.a5 = tk.IntVar()
    
            text1 = tk.Label(Frame1, text="Kabelnamn:", font=("Helvetica", 12, "bold")).grid(column=0, row=1, sticky=(W), columnspan=2)
            Kabelnamn_entry = tk.Entry(Frame1, font=('Helvetica', 12, 'bold'), textvariable=self.a1)
            Kabelnamn_entry.grid(column=0, row=2, sticky=(W, E), columnspan=2)
            
            text2 = tk.Label(Frame1, text="Kabelnummer:", font=("Helvetica", 12, "bold")).grid(column=0, row=3, sticky=(W), columnspan=2)
            Kabelnummer_entry = tk.Entry(Frame1, font=('Helvetica', 12, 'bold'), textvariable=self.a2)
            Kabelnummer_entry.grid(column=0, row=4, sticky=(W, E), columnspan=2)
            
            text3 = tk.Label(Frame1, text="Parter från:  Till:", font=("Helvetica", 12, "bold")).grid(column=0, row=5, sticky=(W), columnspan=1)
            
            part1_entry = tk.Entry(Frame1, font=('Helvetica', 12, 'bold'), textvariable=self.a3, validate = 'key', validatecommand = vcmd, width = 11)
            part1_entry.grid(column=0, row=6, sticky=(W), columnspan=1)
            part1_entry.delete(0, END)    
    
            part2_entry = tk.Entry(Frame1, font=('Helvetica', 12, 'bold'), textvariable=self.a5, validate = 'key', validatecommand = vcmd, width = 11)
            part2_entry.grid(column=0, row=6, sticky=(E), columnspan=1)
            part2_entry.delete(0, END)    
    
            button1 = tk.Button(Frame1, text="Make",  command=self.funktion, width = 16)
            button1.grid(column=0, row=7, sticky=(W, E), columnspan=4)   
    
            button2 = tk.Button(Frame1, text="Spara",  command=self.file_save, width = 16)
            button2.grid(column=0, row=8, sticky=(W, E), columnspan=4)
      
            top1.update()
            top1.resizable(width=False, height=False)     
            top1.mainloop()
            
        def validate(self, action, index, value_if_allowed,
                           prior_value, text, validation_type, trigger_type, widget_name):
            if text in '0123456789.-+':
                try:
                    float(value_if_allowed)
                    return True
                except ValueError:
                    return False
            else:
                return False
            
        def file_save(self):                 
            file = tk.filedialog.asksaveasfile(defaultextension=".txt", mode='wt', filetypes = (("txt files","*.txt"),("all files","*.*")))  
            if file:
                data = self.text_entry.get('1.0', END+'-1c')
                file.write(data)
                file.close()
                
        def funktion(self):
            value1 = (self.a1.get())
            value2 = (self.a2.get())
            value3 = (self.a3.get())
            value4 = (self.a4.get())
            value5 = (self.a5.get())
            
            for parts in range(value3-1, value5):
                print('{}-{}-{}-{}\n'.format(value1, value2, parts+1, parts+1))
                self.text_entry.insert(END, '{}-{}-{}-{}\n'.format(value1, value2, parts+1, parts+1))
                self.a4.set('{}-{}-{}-{}\n'.format(value1, value2, parts+1, parts+1))
    
        def close_windows(self):
            self.master.destroy()
    
    def main(): 
        root = tk.Tk()
        app = Demo1(root)
        root.protocol("WM_DELETE_WINDOW")
        root.mainloop()
    
    if __name__ == '__main__':
        main()

