Docxys
Glad you wanted to download Docxys.
Docxys downloadOpen the app and if Windows says it protected your computer, click more info and run anyway.
There you go, have fun!
Docxys app code
import tkinter as tk
from tkinter import ttk, filedialog, colorchooser, messagebox
from tkinter import font as tkfont
from PIL import Image, ImageTk
from io import BytesIO
import requests
from docx import Document
from docx.shared import Inches
# ==============================
# CHANGE ONLY THIS LINE
# ==============================
SITE_URL = "https://survival-world.net/static"
# ==============================
class Docxys:
def __init__(self, root):
self.root = root
self.root.title("Docxys")
self.root.geometry("1100x700")
self.root.configure(bg="#1e1e1e")
self.images = []
self.current_image_id = None
# Load favicon for app icon
icon = self.load_favicon(SITE_URL, size=64)
if icon:
self.root.iconphoto(True, icon)
self.app_icon = icon # prevent garbage collection
self.setup_style()
self.create_toolbar()
self.create_editor()
# ---------------- STYLE ---------------- #
def setup_style(self):
style = ttk.Style()
style.theme_use("clam")
style.configure("TFrame", background="#1e1e1e")
style.configure("TButton", background="#333333", foreground="white", padding=6)
style.map("TButton", background=[("active", "#444444")])
style.configure("TCombobox",
fieldbackground="#2b2b2b",
background="#2b2b2b",
foreground="white")
# ---------------- TOOLBAR ---------------- #
def create_toolbar(self):
toolbar = ttk.Frame(self.root)
toolbar.pack(fill="x")
# Toolbar favicon
self.toolbar_logo = self.load_favicon(SITE_URL, size=30)
if self.toolbar_logo:
ttk.Label(toolbar, image=self.toolbar_logo).pack(side="left", padx=5)
# Font family
self.font_family = tk.StringVar(value="Arial")
fonts = list(tkfont.families())
font_box = ttk.Combobox(toolbar,
textvariable=self.font_family,
values=fonts,
width=18)
font_box.pack(side="left", padx=5)
font_box.bind("<<ComboboxSelected>>", self.update_font)
# Font size
self.font_size = tk.IntVar(value=14)
size_box = ttk.Combobox(toolbar,
textvariable=self.font_size,
values=[8,9,10,11,12,14,16,18,20,24,28,32],
width=5)
size_box.pack(side="left", padx=5)
size_box.bind("<<ComboboxSelected>>", self.update_font)
ttk.Button(toolbar, text="B", command=self.make_bold).pack(side="left", padx=3)
ttk.Button(toolbar, text="I", command=self.make_italic).pack(side="left", padx=3)
ttk.Button(toolbar, text="U", command=self.make_underline).pack(side="left", padx=3)
ttk.Button(toolbar, text="Text Color", command=self.change_text_color).pack(side="left", padx=5)
ttk.Button(toolbar, text="Insert Picture", command=self.insert_image).pack(side="left", padx=10)
ttk.Button(toolbar, text="Bring Front", command=self.bring_front).pack(side="left", padx=3)
ttk.Button(toolbar, text="Send Back", command=self.send_back).pack(side="left", padx=3)
ttk.Button(toolbar, text="New", command=self.new_file).pack(side="right", padx=5)
ttk.Button(toolbar, text="Open", command=self.open_file).pack(side="right", padx=5)
ttk.Button(toolbar, text="Save .docx", command=self.save_docx).pack(side="right", padx=5)
# ---------------- EDITOR ---------------- #
def create_editor(self):
self.canvas = tk.Canvas(self.root, bg="#1e1e1e", highlightthickness=0)
self.canvas.pack(fill="both", expand=True)
self.text = tk.Text(self.canvas,
wrap="word",
undo=True,
bg="#1e1e1e",
fg="white",
insertbackground="white",
relief="flat",
font=("Arial", 14))
self.canvas.create_window(0, 0, anchor="nw",
window=self.text,
width=1000,
height=650)
# ---------------- FONT ---------------- #
def update_font(self, event=None):
self.text.configure(font=(self.font_family.get(), self.font_size.get()))
def apply_tag(self, tag, style):
try:
start = self.text.index("sel.first")
end = self.text.index("sel.last")
self.text.tag_configure(tag, font=style)
self.text.tag_add(tag, start, end)
except:
messagebox.showinfo("Select text", "Select text first.")
def make_bold(self):
self.apply_tag("bold",
(self.font_family.get(),
self.font_size.get(),
"bold"))
def make_italic(self):
self.apply_tag("italic",
(self.font_family.get(),
self.font_size.get(),
"italic"))
def make_underline(self):
self.apply_tag("underline",
(self.font_family.get(),
self.font_size.get(),
"underline"))
def change_text_color(self):
color = colorchooser.askcolor()[1]
if color:
self.text.tag_configure("color", foreground=color)
try:
start = self.text.index("sel.first")
end = self.text.index("sel.last")
self.text.tag_add("color", start, end)
except:
pass
# ---------------- IMAGE ---------------- #
def insert_image(self):
file_path = filedialog.askopenfilename(
filetypes=[("Images", "*.png *.jpg *.jpeg *.gif")]
)
if file_path:
img = Image.open(file_path)
img = img.resize((300, 200))
photo = ImageTk.PhotoImage(img)
image_id = self.canvas.create_image(200, 200,
image=photo,
anchor="nw")
self.images.append((image_id, photo, file_path))
self.current_image_id = image_id
self.canvas.tag_bind(image_id, "<Button-1>", self.select_image)
self.canvas.tag_bind(image_id, "<B1-Motion>", self.drag_image)
def select_image(self, event):
self.drag_x = event.x
self.drag_y = event.y
self.current_image_id = self.canvas.find_closest(event.x, event.y)[0]
def drag_image(self, event):
dx = event.x - self.drag_x
dy = event.y - self.drag_y
self.canvas.move(self.current_image_id, dx, dy)
self.drag_x = event.x
self.drag_y = event.y
def bring_front(self):
if self.current_image_id:
self.canvas.tag_raise(self.current_image_id)
def send_back(self):
if self.current_image_id:
self.canvas.tag_lower(self.current_image_id)
# ---------------- FILE ---------------- #
def new_file(self):
self.text.delete("1.0", tk.END)
for img in self.images:
self.canvas.delete(img[0])
self.images.clear()
def open_file(self):
file_path = filedialog.askopenfilename(
filetypes=[("Text Files", "*.txt")]
)
if file_path:
with open(file_path, "r", encoding="utf-8") as f:
self.text.delete("1.0", tk.END)
self.text.insert(tk.END, f.read())
def save_docx(self):
file_path = filedialog.asksaveasfilename(
defaultextension=".docx",
filetypes=[("Word Document", "*.docx")]
)
if file_path:
document = Document()
document.add_paragraph(self.text.get("1.0", tk.END))
for img in self.images:
document.add_picture(img[2], width=Inches(4))
document.save(file_path)
messagebox.showinfo("Saved", "Saved successfully as .docx!")
# ---------------- FAVICON ---------------- #
def load_favicon(self, website_url, size=64):
try:
website_url = website_url.rstrip("/")
favicon_url = website_url + "/favicon.ico"
resp = requests.get(favicon_url, timeout=5)
resp.raise_for_status()
image = Image.open(BytesIO(resp.content))
image = image.resize((size, size))
return ImageTk.PhotoImage(image)
except Exception as e:
print("Favicon load failed:", e)
return None
if __name__ == "__main__":
root = tk.Tk()
app = Docxys(root)
root.mainloop()