Giter VIP home page Giter VIP logo

Comments (4)

xmlztw avatar xmlztw commented on May 30, 2024

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

Detailed Description

How do I redraw the entire window layout in PySimpleGUI? I tried calling self.window.layout(layout), but it didn't work.

from pysimplegui.

jason990420 avatar jason990420 commented on May 30, 2024

More detailed information: Missing Troubleshooting Section

Better not to remove any section of the issue form, like this

Troubleshooting

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

  • Searched main docs for your problem PySimpleGUI Documenation
  • Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demo Programs
  • None of your GUI code was generated by an AI algorithm like GPT
  • 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)
  • Run your program outside of your debugger (from a command line)
  • Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.com
  • Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
  • Tried running the Development Build. Your problem may have already been fixed but not released. Check Home Window for release notes and upgrading capability
  • For licensing questions please email [email protected]

from pysimplegui.

jason990420 avatar jason990420 commented on May 30, 2024

layout(rows)

Second of two preferred ways of telling a Window what its layout is. The other way is to pass the layout as
a parameter to Window object. The parameter method is the currently preferred method. This call to Layout
has been removed from examples contained in documents and in the Demo Programs. Trying to remove this call
from history and replace with sending as a parameter to Window.

To update your GUI immediately, call window.refresh(), or the GUI will be updated only until you call window.raad().

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()

from pysimplegui.

PySimpleGUI avatar PySimpleGUI commented on May 30, 2024

If you want to retain the values already entered into the window, then you can use the new setting parameter was added to elements in the PySimpleGUI 5 release.

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:
https://docs.pysimplegui.com/en/latest/documentation/module/user_settings/#settings-defined-in-layouts

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.

https://github.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms/Demo_User_Settings_Element_setting_Parameter.py

from pysimplegui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.