In Tkinter, I am trying to make the askdirectory menu more user friendly. Is there a way to center the focus of the window on the last folder opened, both vertically and horizontally? I don't want my users to have to scroll right when they get deep into subfolders.

def action1():
    master.withdraw()
    dirname = tkFileDialog.askdirectory(parent=master,initialdir='./',title='Please select Lot directory')
    global dirname  
    master.destroy()

Recommended Answers

All 2 Replies

Give starting directionary as initialdir passed to the function as parameter, return current directory as value from function and save in caller, no globals.

Okay,

 def action1(i_directory):
     master.withdraw()
     dirname = tkFileDialog.askdirectory(parent=master,initialdir=i_directory,title='Please select Lot directory')

     master.destroy()

Can someone please answer my question? How can i resize the Tkinter askdirectory window. to fit all the subdirectories i want to open without having to scroll. Im going through about 8 subfolders.
\computer\longfoldername\longfoldername1\longfoldername\longfoldername\longfoldername\longfoldername\subfolder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.