PySimpleGUI / PySimpleGUI

Python GUIs for Humans! PySimpleGUI is the top-rated Python application development environment. Launched in 2018 and actively developed, maintained, and supported in 2024. Transforms tkinter, Qt, WxPython, and Remi into a simple, intuitive, and fun experience for both hobbyists and expert users.

Home Page:https://www.PySimpleGUI.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] Any way to change the initial_folder in FolderBrowse button after program is started?

tthkbw opened this issue · comments

Type of Issue (Enhancement, Error, Bug, Question)

Question----------------------------------------

Operating System

macOS 12.3.1 running on Apple Silicon

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter version: 8.6.8
PySimpleGUI version: 4.59.0


Versions

Python version: 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)
[Clang 6.0 (clang-600.0.57)]
port: tkinter
tkinter version: 8.6.8
PySimpleGUI version: 4.59.0
PySimpleGUI filename: /Users/tbrown/Library/Python/3.8/lib/python/site-packages/PySimpleGUI/PySimpleGUI.py

Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()

Python version (sg.sys.version)

PySimpleGUI Version (sg.__version__)

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)


Your Experience In Months or Years (optional)

Years Python programming experience 5

Years Programming experience overall 40

Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine) yes

Anything else you think would be helpful?


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

  • [x ] Searched main docs for your problem www.PySimpleGUI.org
  • [x ] Looked for Demo Programs that are similar to your goal Demos.PySimpleGUI.org
  • If not tkinter - looked for Demo Programs for specific port
  • For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
  • [ x] Run your program outside of your debugger (from a command line)
  • [ x] Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
  • [x ] Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

Detailed Description

I know that I can specify "initial_directory" to a FolderBrowse button and it will open initially in that directory. However, I cannot find a way to change this after the program is running.

WhatI would like is to be able to get information while the program is running that can then be used to changed the directory that is initially opened by the FolderBrowse button. I tried using browsebutton.update(initial_directory = newdirectory) but it doesn't like it.

Can this be done?

Code To Duplicate

A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

This pre-formatted code block is all set for you to paste in your bit of code:

# Paste your code here

Screenshot, Sketch, or Drawing


Watcha Makin?

If you care to share something about your project, it would be awesome to hear what you're building.

Duplicate as issue #3703

Thank you! I need to refine my search skills. I got so many hits on FolderBrowse, but couldn't find the answer. The key was to add initial folder to the search to get to this solution more effectively.

Hmmmm... maybe I should add something to the docstring for FolderBrowse. It's not something I anticipated needing to be done when designing it.

I would be better if I added a property perhaps so that it ends up in the Button methods in the SDK Call Reference.

@tthkbw Your search skills are excellent I'm pretty sure! There are 2.724 issues (open+closed) so there's quite a bit to pour through. Glad you opened an issue!