rdbende/tkcode

Unable to change language of CodeEditor

whmsft opened this issue · 4 comments

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..

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.

it does not work..

Could you show me what kind of error you get?

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