ParthJadhav / Tkinter-Designer

An easy and fast way to create a Python GUI 🐍
BSD 3-Clause "New" or "Revised" License
8.63k stars 794 forks source link

idlelib.colorizer and idlelib.percolator #331

Open 1lolplayer1 opened 1 year ago

1lolplayer1 commented 1 year ago

I am making IDE for python and want to use idlelib.colorizer and idlelib.percolator packages to give code colors. it worked on tkinter but now I changed code to work on customtkinter as it has more modern GUI. it gives me this error: AttributeError: 'CTkTextbox' object has no attribute 'tag_configure' the code itself:

cdg.prog = re.compile(r'\b(?P<MYGROUP>tkinter)\b|' + ic.make_pat(), re.S)
cdg.idprog = r"(?<!class)\s+(\w+)"

background = '#282923'

cdg.tagdefs['MYGROUP'] = {'foreground': '#7F7F7F', 'background': '#282923'}

# These five lines are optional. If omitted, default colours are used.
cdg.tagdefs['COMMENT'] = {'foreground': '#007F00 ', 'background': '#282923'}
cdg.tagdefs['KEYWORD'] = {'foreground': '#27b1dd', 'background': '#282923'}
cdg.tagdefs['BUILTIN'] = {'foreground': '#dddd22', 'background': '#282923'}
cdg.tagdefs['STRING'] = {'foreground': '#8b9b40', 'background': '#282923'}
cdg.tagdefs['DEFINITION'] = {'foreground': '#27b9b9', 'background': '#282923'}

ip.Percolator(editArea).insertfilter(cdg)
ghost commented 1 year ago

@1lolplayer1 - Based on the error message (and provided code), this seems like an error with your version of TkinterDesigner.

but now I changed code to work on customtkinter as it has more modern GUI.

The error could have occurred as a result of your changes to TkinterDesigner.

I looked through CTk's source code and found that CTkTextbox does not have a method/attribute named .tag_configure(). The closest thing I could find was .tag_config(). Try using that.

The source code for CTkTextbox can be found here.

Perhaps close as "not planned" as it doesn't appear to be an issue with TkinterDesigner.

1lolplayer1 commented 1 year ago

Thanks for answering I'll try that out

ghost commented 1 year ago

@1lolplayer1 - Let me know if that resolved the issue 😄