MCPcopy Index your code
hub / github.com/Akascape/CTkCodeBox

github.com/Akascape/CTkCodeBox @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
27 symbols 81 edges 5 files 10 documented · 37% updated 1y ago★ 441 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CTkCodeBox

A code editor widget for customtkinter. image

Features

  • Multiple language support
  • Code syntax highlighting
  • Multiple Themes
  • Right-click copy-paste menu
  • Line numbers on left side
  • Fully customizable
  • Easy to Use

Installation

GitHub repo size

Download the source code, paste the CTkCodeBox folder in the directory where your program is present.

Requirements: Pygments and TkLineNums

Simple Usage

import customtkinter
from CTkCodeBox import *

root = customtkinter.CTk()

codebox = CTkCodeBox(root, language="python")
codebox.pack(padx=10, pady=10, expand=True,fill="both")

root.mainloop()

Arguments

Parameter Description
width change the default width of the widget
height change the default height of the widget
fg_color change the fg_color of the widget
language set the language lexer for the codebox
theme change the overall color theme for the code syntax
line_numbering boolean, enable or disable the line numbering
numbering_color change text color of the line numbering
menu boolean, enable or disable the right click popup menu
menu_fg_color color of the menu (optional)
menu_text_color text color of the menu buttons (optional)
menu_hover_color hover color of the menu buttons (optional)
wrap enable or disabled word wrapping in the textbox
select_color change the selection color of the codebox
cursor_color change the cursor color I (blinking)
undo boolean, enable or disable the undo text feature
*Other Parameters All other parameters of ctktextbox can be passed in ctkcodebox

Methods

  • .insert(index, code): insert code in the box
  • .configure(kwargs): change parameters of the codebox
  • .cget(parameter): get the parameter name from the codebox
  • .update_code(): update the code syntax colors
  • .clear_code(): delete all the code from the box

Languages

More lexers available here: https://pygments.org/docs/lexers/

Color Themes

abap, arduino, autumn, borland, colorful, default, dracula, emacs, friendly_grayscale, friendly, fruity, github-dark, gruvbox-dark, gruvbox-light, igor, inkpot, lightbulb, lilypond, lovelace, manni, material, monokai, murphy, native, nord-darker, nord, one-dark, paraiso-dark, paraiso-light, pastie, perldoc, rainbow_dash, rrt, sas, solarized-dark, solarized-light, staroffice, stata-dark, stata-light, tango, trac, vim, vs, xcode, zenburn

More style examples given here: https://pygments.org/styles/

Follow me for more stuff like this: Akascape

That's all, hope this project can help!

Core symbols most depended-on inside this repo

cget
called by 4
CTkCodeBox/ctk_code_box.py
insert
called by 3
CTkCodeBox/ctk_code_box.py
configure
called by 3
CTkCodeBox/ctk_code_box.py
do_popup
called by 2
CTkCodeBox/text_menu.py
check_lexer
called by 2
CTkCodeBox/ctk_code_box.py
configure_tags
called by 2
CTkCodeBox/ctk_code_box.py
copy_text
called by 1
CTkCodeBox/text_menu.py
update_code
called by 1
CTkCodeBox/ctk_code_box.py

Shape

Method 22
Class 3
Function 2

Languages

Python100%

Modules by API surface

CTkCodeBox/ctk_code_box.py15 symbols
CTkCodeBox/text_menu.py10 symbols
theme_example.py2 symbols

For agents

$ claude mcp add CTkCodeBox \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact