I've written a short script for finding and saving certain files. I used the following line to pick a save location:
ask_dir = tkFileDialog.askdirectory(initialdir= os.path.dirname(sys.argv[0]))
However, the askdirectory window (at least on my WinXP machine) is excessively small, and it is not resizable. Tkinter does not seem to have any obvious command for increasing this window size - see link here. How can I fix this?
On Windows, the FolderBrowserDialog
function seems to be used, which can't be resized easily, although it probably can be resized with some effort.
Some clues can be found here, this code can be 'translated' to Python using the pywin32 module.
Here's some basic code to resize the window, to illustrate how this would work:
import win32gui
win = win32gui.FindWindowEx(None, None, "NULL,"#32770", None)
win32gui.SetWindowPos(win, 0, 500, 500, 900, 900, 0)
You will also need to a) fetch current position, and use that instead of a hardcoded value, and b) resize all the widgets inside the window (see linked article).
Problems:
#32770
(win7, 64-bit), it doesn't look very portable to me ... I didn't investigate as to the cause of this.askdirectory
is blocking, so you need to do start a separate thread, poll if the window is open, then resize it. Not only is this ugly, it's also possible the user sees 'flicker' of the old window size, before it's resized.I understand your problem, and the 'Open folder' dialog has a horrible usability, but it would seem significant amount of effort is required to increase the size.
Replacing it with something else might be an option, although that would break the OS's UI conventions, which also isn't good ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With