[ Bug] auto_save_location causes problem if window is not moved.

Author: David-S-MorganCreated Aug 25, 2026Updated Aug 28, 2026
LabelsBugDone - Install Dev Build (see docs for how)Port - TKPlatform Specific Issue - Linux

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

Bug

Operating System

Ubuntu 24.04.4

PySimpleGUI Port

tkinter


Versions

NOTE - PSG4 is no longer supported

Python 3.12.3 PSG 6.3 TKinter 8.6.14


Your Experience In Months or Years (optional)

Years Python programming experience: 25

Years Programming experience overall: 40+

Have used another Python GUI Framework? (tkinter, Qt, etc) Nope

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 PySimpleGUI Documenation
  • [ x] Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demo Programs
  • [x ] None of your GUI code was generated by an AI algorithm like GPT
  • [N/A ] If not tkinter - looked for Demo Programs for specific port
  • [N/A ] 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.com
  • [x ] Upgraded to the latest release of PySimpleGUI on PyPI (Version 6)

Detailed Description

I noticed that _last_location is initialized as (None,None), but then is never updated/initialized if you run a pysimplegui program and quit it without ever moving the window. My quick fix is to do:

python
        def _auto_save_location(self):
        """
        Internal function to save the location of the window in the settings file
        :return:
        """     
        if self.auto_save_location:
            # If the window is not moved, then (Null,Null) is the
            # location, so don't try to save it.
            if None not in self._last_location:
                user_settings_set_entry('-LAST WINDOW LOCATION-'+self.Title, self._last_location)

Then, if the window isn't moved, quitting and restarting places the window at its prior location, or the default location if a location wasn't moved at all initially. Not sure this is the best/proper fix, but it works for me for now.

Screenshot, Sketch, or Drawing


Watcha Makin?

GUI front-end to zfs+rsync backup software I wrote.