Avatar ·

Python: Notification in Windows Notification Center

📁 Advanced Python Topics

How to send a notification to the Windows 10 Notification Center using Python?

Avatar ·

Warning: the implementation in the answer is not optimal and will lag when scrolling through a large number of lines. For non-educational purposes, I recommend using the module


You need to perform lexical analysis (parsing) of the text - split the text into highlightable pieces (tokens), and highlight pieces of text differently depending on the token type. For simplicity, you can use a ready-made parser, for example, from the library (installed using pip install pygments). You can also use the module from the Python standard library if you only need to highlight Python code.

Below is a quick-and-dirty example with highlighting of keywords and string literals (works suboptimally - on every change it removes all highlighting, re-parses the text into tokens, and re-applies highlighting).

Log in to leave an answer

Blogs