ragardner / tksheet

Python tkinter table widget for displaying tabular data
https://pypi.org/project/tksheet/
MIT License
400 stars 48 forks source link

SyntaxWarning #205

Closed jonyscathe closed 7 months ago

jonyscathe commented 10 months ago

Hi, I'm getting a syntax warning in Python 3.12.0

/home/.../.cache/pypoetry/virtualenvs/...-af0V9KsP-py3.12/lib/python3.12/site-packages/tksheet/_tksheet_vars.py:9: SyntaxWarning: invalid escape sequence '\$'
  symbols_set = set("""!#\$%&'()*+,-./:;"@[]^_`{|}~>?= """)

Am guessing it should really be symbols_set = set("""!#\\$%&'()*+,-./:;"@[]^_{|}~>?= """)`?

rdbende commented 10 months ago

I think it actually should just be a raw string, where the backslash doesn't have any special meaning:

symbols_set = set(r"""!#\$%&'()*+,-./:;"@[]^_`{|}~>?= """)
ragardner commented 10 months ago

Thanks very much for pointing this out, it should be fixed in tksheet version 6.3.4

ragardner commented 10 months ago

I think it actually should just be a raw string, where the backslash doesn't have any special meaning:

symbols_set = set(r"""!#\$%&'()*+,-./:;"@[]^_`{|}~>?= """)

It was meant to detect any symbol keyboard input but I will probably change it to something else at some point. I've seen string.printable might be a good solution for any keyboard entry