My code has the following problems:
The main window and select the folder window (not the address bar) pop up at the same time,
Please help to modify the following code
Renamer_V1. Py:
the import the OSThe import win32file
The import win32con
The import tkinter as tk
The from tkinter import Button
The from clicked import clicked
Root=tk. Tk ()
Root. Geometry (" 550 x200 ")
Label=tk. Label (root, the font=(" Arial Bold ", 15), the text='both Please select a directory to rename files in the folder:')
Label. Pack ()
C=Clicked ()
BTN=Button (root, the font=(" Arial ", 15), bg='orange', the text="Click Me", the command=Arthur c. licked)
BTN. Pack ()
Arthur c. licked ()
File_lists=OS. Listdir (c.f ile_path)
N=0
For file in file_lists. Copy () :
Oldname=c.f ile_path + OS. Sep + file
File_flag=win32file. GetFileAttributesW (oldname)
Is_hiden=file_flag & amp; Win32con. FILE_ATTRIBUTE_HIDDEN
If OS. Path. Isdir (oldname) or is_hiden:
The continue
The else:
Oldname=c.f ile_path + OS. Sep + file
Newname=c.f ile_path + OS. Sep + '(' + STR (n + 1) +') '+ file
OS. Rename (oldname, newname)
N +=1
Label=tk. Label (root, text=STR (n) + 'file (s) renamed.')
Label. Pack ()
Root. Mainloop ()
Clicked. Py:
The from tkinter import filedialog
The class Clicked:
File_path=None
Def __init__ (self) :
Print ()
Def clicked (self) :
The self. The file_path=filedialog. Askdirectory (title='ReNamer')