spyoungtech / FreeSimpleGUI

The free-forever GUI library
GNU Lesser General Public License v3.0
272 stars 35 forks source link

Backward (in)compatibility with Python 3.4 #25

Closed Pherkad closed 1 month ago

Pherkad commented 1 month ago

I'm using Python 3.4.1-1 and I just want to mention that FreeSimpleGUI 5.1.0 is not compatible with it. When attempting to execute FreeSimpleGUI 5.1.0 in Python 3.4.1-1 it stops with an error:

========================= File "FreeSimpleGUI.py", line 138 print(f'{func.name} executed in {end - start:.4f} seconds') ^ SyntaxError: invalid syntax

This is because Python 3.4 does not know about "F-Strings"

Aside from that, errors are also caused by the usage of the precision operator in the F-Strings (such as "start:.4f") and more errors are caused by using a comma after the last argument of all functions (I don't even know if that's proper programming - I wonder how can this work in any version of Python ??)

I'm currently going through FreeSimpleGUI.py and correcting all this in order to make it actually run in Python 3.4

yunluo commented 1 month ago

I am also preparing to ask this question, pysimplegui is compatible with 3.4, currently using this GUI library will still exist using Windows XP system, basically using f-string caused by incompatibility, in fact, change to format can also be

spyoungtech commented 1 month ago

PySimpleGUI was not and is not compatible with Python 3.4 (despite what its documentation or source code comments may suggest) -- the f-string was there before this fork was created. As noted in v5.1.0 we do not officially support EOL Python versions and 3.6 was the lowest syntax-compatible version of Python that worked prior to this.

spyoungtech commented 1 month ago

Given that this incompatibility already existed in PySimpleGUI, that Python 3.4 has been EOL for over 5 years, and that this project explicitly is not aiming to support EOL Python versions, I am going to close this issue.


That said and with the understanding that use of Python 3.4 (or other EOL versions) is unsupported, as a possible hack to help you or others in this situation, you could consider using something like future-fstrings which can dynamically rewrite a module just by adding an encoding comment, rather than rewriting all uses of fstrings by hand. But be aware there may be other incompatibilities that exist and, almost certainly, future versions of FreeSimpleGUI will, in all likelihood, introduce more changes that are not compatible with certain EOL Python versions.