May-19-2020, 02:33 PM
Hi,
I am doing a callback on OptionMenu. as per the below code when the condition if source == destination then i would like to generate an error message box and don't proceed for further processing.
I did root.destroy() but its creating an empty tk window and the processing won't stop.
Please guide me.
I am doing a callback on OptionMenu. as per the below code when the condition if source == destination then i would like to generate an error message box and don't proceed for further processing.
I did root.destroy() but its creating an empty tk window and the processing won't stop.
Please guide me.
def callback(self,*args):
source = self.frm.pathe1.get()
dest = self.frm.pathe2.get()
ext = self.frm.extoption.get()
print("User selected input path: ",source)
print("User selected destination path: ", dest)
print("User selected extension type: ", ext)
if source == dest:
messagebox.showinfo("Title","Destination path can not be same as Input path")
root.destroy()
pattern = str("*." + self.frm.extoption.get())
dest = dest + "/" + ext
print("Files will be copied to: ", dest)
if os.path.isdir(dest) == True:
shutil.rmtree(dest)
p = App1.include_patterns(pattern)
shutil.copytree(source,dest,ignore=p)
messagebox.showinfo("Files move based on extension","Desired extension files copied to: " + dest)
