How to handle constants in a script

I’m looking at pyGame and all the constants used. PyCharm does not like the capitalized letters as the constants.
What is the correct way to handle constants in Python?

Thanks for clearing that up.

Using uppercase identifiers for constants is a well established convention in Python, described in PEP8. I would be very surprised if PyCharm did not respect that.

I think we could say more only if you show a short, self-contained example of such a code and copy the message PyCharm shows to you.

My bad! Its not the contants but the typos of constants and statements.

I hate seeing all the faults show up. I understand I can just ignore them, but , just saying it is annoying.

I am using a spell checker too. It caught many typos of mine!

I am using “Code Spell Checker” in VS Code where it has to be installed as an extension from the store. I do not know the capabilities of the PyCharm spell checker but in VS Code I can:

  • Use underscore _ to separate words. Examples from your screenshot: photo_image, mouse_icon.png… I would go this path in your case.
  • Add a word to the project dictionary or my personal dictionary. I use this for symbols from a library.
  • I can configure spell checking so it is more tolerant.
  • I can disable the spell checker (or change its parameter) file-by-file using a directive.

Yes, using the ‘_’ between words works, so I will set that as my standard for constants.