Search code examples
pythonfunctiontkintervisual-studio-codehighlight

Vscode atom dark theme not highlighting tkinter


When I use from tkinter import * in vscode with atom one dark theme, I get no highlights from tkinter functions, though my code is still working.

enter image description here

In the picture, pack(), Tk(), Label and mainloop() is supposed to be highlighted (I know this, cause they are in the actual atom software). Is there anyway to fix this?

Thanks!


Solution

  • There is nothing wrong with the code editor nor the theme. Its just how most of the theme works. Which part do you expect to be highlighted? All tkinter widgets(Label,Entry,etc.) are classes, and most themes do not have any highlighting for classes. I don't think much themes would have highlighting on class names and function names as its used very frequently.

    "In the picture, pack(), Tk(), Label and mainloop() is supposed to be highlighted. Is there anyway to fix this?"

    "Is supposed to be highlighted" is wrong words to use, as most themes does not highlight classes.

    What usually has highlighting is, all the keywords and keyword arguments and string, etc. Since these are highlighted in your code, its working perfectly. I don't think there are any "special effects" for tkinter, as any theme for python is same as any theme for tkinter.

    One way to get your desired effect, is to use a different theme, that actually will highlight classes (maybe monokai or some material themes?). I personally don't prefer alot of theme around, so something like this is perfect. Or the other way is to make or customize your themes, which can mess up the color if you are not sure what your doing.