-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] How do I redraw the entire window layout in PySimpleGUI #6721
Comments
|
Better not to remove any section of the issue form, like this TroubleshootingThese items may solve your problem. Please check those you've done by changing - [ ] to - [X]
|
To update your GUI immediately, call To renew your window, you may do it like following example, new elements in the layout will all be reinitialized, not reuse the layout. import PySimpleGUI as sg
def new_window(width=45):
layout = [[sg.Input(size=width, key='-IN-'), sg.Button("OK")]]
return sg.Window("Title", layout, finalize=True)
window = new_window()
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
elif event == "OK":
try:
n = int(values['-IN-'])
except:
n = -1
if 0 < n < 80:
win = new_window(n)
window.close()
window = win
window.close() |
If you want to retain the values already entered into the window, then you can use the new You will need to upgrade your environment, which I recommend regardless as you're running a very old version of Python (3.4) and an extremely old version of tkinter (8.6.1). You should be getting a warning message about your tkinter version being too old. The parameter is shown in the documentation, primarily here: I added a Demo Program that shows how to use this parameter as well and included an example of "restarting" / redrawing a window should you need a feature like this for you application. |
Type of Issue : Question
Operating System
PySimpleGUI Port : tkinter
Versions
Version information can be obtained by calling
sg.main_get_debug_data()
Or you can print each version shown in ()
Python version : 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)]
PySimpleGUI Version : 4.60.5
GUI Version : 8.6.1
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
Detailed Description
How do I redraw the entire window layout in PySimpleGUI? I tried calling self.window.layout(layout), but it didn't work.
The text was updated successfully, but these errors were encountered: