from Tkinter import *
import socket, sys, os
import tkMessageBox
root = Tk()
root.title("File Deleter v1.0")
root.config(bg='black')
root.resizable(0, 0)
text = Text()
text3 = Text()
frame = Frame(root)
frame.config(bg="black")
frame.pack(pady=10, padx=5)
frame1 = Frame(root)
frame1.config(bg="black")
frame1.pack(pady=10, padx=5)
text.config(width=35, height=1, bg="black", fg="white")
text.pack(padx=5)
def button1():
try:
x = text.get("1.0", END)
os.remove(x)
except WindowsError:
text3.insert(END, "File Not Found... Try Again\n")
def clear():
text.delete("1.0", END)
c = Button(frame1, text="Clear", width=10, height=2, command=clear)
c.config(fg="white", bg="black")
c.pack(side=LEFT, padx=5)
scrollbar = Scrollbar(root)
scrollbar.pack(side=RIGHT, fill=Y)
text3.config(width=35, height=15, bg="black", fg="white")
text3.pack(side=LEFT, fill=Y)
scrollbar.config(command=text3.yview)
text3.config(yscrollcommand=scrollbar.set)
w = Label(frame, text="Delete A File")
w.config(bg='black', fg='white')
w.pack(side=TOP, padx=5)
b = Button(frame1, text="Enter", width=10, height=2, command=button1)
b.config(fg="white", bg="black")
b.pack(side=LEFT, padx=5)
root.mainloop()
I dont get why the delete code is not working, I get a "File not Found" even if the file exist.