Home > other >  Have bosses how help me answer the python in the main function to extract path_ obtained the path
Have bosses how help me answer the python in the main function to extract path_ obtained the path

Time:03-12

The from tkinter import *
The from tkinter. Filedialog import askdirectory
Def selectPath () : path_=askdirectory () path. Set (path_)
Root=Tk ()
Path=StringVar ()
Label (root, text="target path:"). The grid (row=0, the column=0) Entry (root, textvariable=path). The grid (row=0, the column=1)
Button (root, text="routing", the command=selectPath). The grid (row=0, the column=2) root. The mainloop ()

CodePudding user response:

Have bosses to give directions?

CodePudding user response:

According to your code can be executed!
 
The from tkinter import *
The from tkinter. Filedialog import askdirectory

Def selectPath () :
Path_=askdirectory ()
Path. The set (path_)

Root=Tk ()
Path=StringVar ()
The Label (root, text="target path:"). The grid (row=0, the column=0)
Entry (root, textvariable=path). The grid (row=0, the column=1)
Button (root, text="routing", the command=selectPath). The grid (row=0, the column=2)
Root. Mainloop ()

CodePudding user response:

After you choose the path, the path of the value is displayed in the entry,

CodePudding user response:

If you want to get the value of the path is the path. The get ()
Are you ask this mean?
  • Related