Cupcake is an Embeddable modern-looking code editor for python tkinter applications. It has rich Autocompletions, Minimap and Semantic Syntax highlighting. Cupcake is written in pure python with the tkinter library. It is the code editor which powers Biscuit.
import tkinter as tk
from cupcake import Editor, Languages
root = tk.Tk()
root.minsize(800, 600)
e = Editor(root, language=Languages.TYPESCRIPT)
e.pack(expand=1, fill=tk.BOTH)
e.content.insert("end", """
// check this out
import "./theme.scss";
import "./global.css";
import App from './App.svelte';
const app = new App({
target: document.body
});
export default app;
""")
root.mainloop()see examples for instructions on Diff viewer, Image viewer and Theming
Cupcake can be installed by running:
pip install cupcake-editor
Cupcake requires Python 3.10+ to run.
Here is a quick example of embedding cupcake in your project:
import tkinter as tk
from cupcake import Editor
root = tk.Tk()
root.minsize(800, 600)
editor = Editor(root)
editor.pack(expand=1, fill=tk.BOTH)
root.mainloop()Examples demonstrating how to use cupcake are in the examples directory. You can learn how to integrate the editor to your app with these. You can run the examples like python -m examples.hello
- Syntax Highlighting (over 500+ languages supported)
- Auto=Completions (words + keywords)
- Auto-Indentation
- Diff Viewer
- Minimap
- Breadcrumbs and Pathview tree
- Image Viewer
- Fully Customizable and Themable
- Language Detection from File Extensions
- Code Folding
Your contributions and support are greatly appreciated! 🧡 See contributing for further details such as coding guidelines and tools used.