rdbende / tkcode

Use Chlorophyll instead
https://github.com/rdbende/chlorophyll
MIT License
19 stars 3 forks source link

Unable to change language of CodeEditor #5

Closed whmsft closed 3 years ago

whmsft commented 3 years ago

so i was just trying to change the language in the CodeEditor by:

def openfile():
    filepath = askopenfilepath(.....)
    extension = filepath.split('.')[-1]
    editor["language"] = identify_extension(extension)

where editor is the CodeEditor() and identify_extension() returns the programming language name for the extension..

but when i ran openfile() the language of the CodeEditor didn't change at all.. and was still the default python for every extension..

rdbende commented 3 years ago

Thanks for reporting this. It's a crazy idiot mistake in the __setitem__ method. And since I don't write unittests, and I don't even try the dict like configuration, I never get an error.

However,

editor.config(language=identify_extension(extension))

should work.

whmsft commented 3 years ago

it does not work..

rdbende commented 3 years ago

Could you show me what kind of error you get?

whmsft commented 3 years ago

okay okay.. it worked.. i just did a stupid mistake in my program.. lol anyways.. thanks for your active help..