In this tutorial, we’ll build SixSeven Studio — a desktop puzzle generator written in Python.
By the end, you’ll have an app that:
Displays a modern Tkinter GUI
Generates logic puzzles
Exports layered SVG files
Creates barcodes
Saves and loads puzzles as JSON
This guide is beginner-friendly and breaks everything into small steps.
✅ Prerequisites
You’ll need:
Python 3.9+
Basic Python knowledge
pip installed
Step 1 — Install Dependencies
Open a terminal and run:
pip install ttkbootstrap svgwrite python-barcode pillow
These libraries provide:
ttkbootstrap → modern Tkinter UI
svgwrite → SVG export
python-barcode → barcode images
pillow → image handling
Step 2 — Create Your Project File
Create a new file:
sixseven_studio.py
Start with imports:
import tkinter as tk
from tkinter import filedialog, messagebox, colorchooser
import ttkbootstrap as tb
from pathlib import Path
import random
import svgwrite
from barcode import EAN13, Code128
from barcode.writer import ImageWriter
import json
import os
Each module handles a different feature:
Tkinter → GUI
svgwrite → vector export
barcode → barcode creation
json → save/load puzzles
Step 3 — Create the Main Application Class
Now define your app:
class SixSevenStudioV5:
def __init__(self):
self.APP_NAME = "SixSeven Studio"
self.APP_VERSION = "v5"
self.root = tk.Tk()
tb.Style(theme="darkly")
self.root.title(f"{self.APP_NAME} {self.APP_VERSION}")
self.root.geometry("1100x750")
This initializes:
The main window
Dark theme
Title and size
Step 4 — App State Variables
Add these inside init:
self.style = tk.StringVar(value="Default")
self.puzzle = tk.StringVar(value="Futoshiki")
self.count = tk.IntVar(value=1)
self.grid_size = tk.IntVar(value=6)
self.bg_color = tk.StringVar(value="#222222")
self.accent_color = tk.StringVar(value="#4caf50")
self.font_size = tk.IntVar(value=24)
self.barcode_type = tk.StringVar(value="EAN13")
self.grid = []
These variables connect your UI controls to logic.
Step 5 — Build the User Interface
Create a method:
def build_ui(self):
tb.Label(self.root, text=self.APP_NAME,
font=("Segoe UI", 22, "bold")).pack(pady=10)
This shows the app title.
Options Panel
opts = tb.Labelframe(self.root, text="Options", padding=10)
opts.pack(fill="x", padx=10)
Add puzzle selection:
tb.Label(opts, text="Puzzle Type:").pack(side="left")
tb.Combobox(
opts,
values=["Futoshiki","Arukone","Hidato","Tents & Trees","No-Four-In-Row"],
textvariable=self.puzzle,
width=20
).pack(side="left", padx=5)
Control Buttons
ctrl = tb.Frame(self.root)
ctrl.pack(fill="x", padx=10, pady=10)
tb.Button(ctrl, text="Generate",
command=self.generate).pack(side="left")
tb.Button(ctrl, text="Export SVG",
command=self.export_svg).pack(side="left", padx=5)
Each button calls a method.
Step 6 — Displaying the Puzzle Grid
Create a grid container:
self.grid_frame = tb.Labelframe(self.root, text="Puzzle Grid", padding=10)
self.grid_frame.pack(fill="both", expand=True)
Then render cells:
def display_grid(self):
for w in self.grid_frame.winfo_children():
w.destroy()
size = self.grid_size.get()
for r in range(size):
for c in range(size):
tb.Label(
self.grid_frame,
text=str(self.grid[r][c]),
width=4,
relief="ridge"
).grid(row=r, column=c, padx=2, pady=2)
This redraws the grid every time puzzles change.
Step 7 — Simple Puzzle Generation
Example: No-Four-In-Row:
def generate_no_four(self, size):
grid = []
for r in range(size):
row = []
for c in range(size):
options = [6, 7]
if len(row) >= 3 and all(x == row[-1] for x in row[-3:]):
options.remove(row[-1])
row.append(random.choice(options))
grid.append(row)
return grid
This prevents four identical values in a row.
Main generator:
def generate(self):
size = self.grid_size.get()
if self.puzzle.get() == "No-Four-In-Row":
self.grid = self.generate_no_four(size)
else:
self.grid = [[random.choice([6,7,""]) for _ in range(size)] for _ in range(size)]
self.display_grid()
Step 8 — Exporting SVG Files
def export_svg(self):
folder = filedialog.askdirectory()
if not folder:
return
Create drawing:
dwg = svgwrite.Drawing("puzzle.svg", size=("700","800"))
Add background:
dwg.add(dwg.rect((0,0),("100%","100%"), fill=self.bg_color.get()))
Draw grid and numbers:
for r in range(size):
for c in range(size):
dwg.add(dwg.text(str(self.grid[r][c]),
insert=(100+c*80,100+r*80)))
Save:
dwg.save()
Step 9 — Barcode Generation
def generate_barcode(self):
code = "".join(str(random.randint(0,9)) for _ in range(12))
barcode = EAN13(code, writer=ImageWriter())
barcode.save("barcode")
This creates a scannable barcode image.
Step 10 — Save & Load Puzzles
Save:
with open("puzzle.json","w") as f:
json.dump(self.grid,f)
Load:
with open("puzzle.json","r") as f:
self.grid = json.load(f)
Step 11 — Run the App
Finally:
if __name__ == "__main__":
SixSevenStudioV5().root.mainloop()
🎉 Done!
You’ve built a desktop puzzle studio with:
Tkinter GUI
Logic puzzle generators
SVG export
Barcode creation
JSON persistence
Full source:
👉 https://github.com/rogers-cyber/SixSevenStudio
Ideas for Extensions
Add PDF export
Add difficulty levels
Improve puzzle algorithms
Add solution generation
Package with PyInstaller

Top comments (0)