Posts

Showing posts with the label technical

Simple Static Site Builder with Jinja2

Image
If you've ever built a small, multi-page website (i.e., a company site, landing page, documentation site, or portfolio) you've likely experienced the pain of maintaining a bunch of HTML files that all contain the same header, navigation, footer, and bits of JavaScript. It works at first, but the moment you need to change something that exists on every page, it becomes tedious fast. At the other end of the spectrum are fully featured static site generators (SSGs) like Hugo, Jekyll, and Gatsby. They're powerful, but they can also be overwhelming and feel like overkill when all you want is a simple website with a few reusable components. In this post, I'll discuss building a lightweight SSG using Jinja2 in python. By treating your HTML files as templates, you can reuse layouts, components, and other shared code without introducing a complex toolchain. The result is a simple workflow that's easy to understand, easy to customize, and perfect for smaller projects whe...

Speeding Up Matplotlib Animations in Tkinter

Image
This will be a short technical post covering the process I used to optimize GUI (Graphical User Interface) updates for my kinematics simulator application (pictured below). Using these brief techniques, I was able to reduce the time spent rendering UI updates by 98.8%. For anyone who's interested, the project can be found  here . It uses matplotlib for animated plots embedded within a tkinter GUI. If you're looking to embed matplotlib inside a GUI application, or even if you're working on standalone animated plots, I'm hoping this post will provide some useful tips for improving performance. Initial Performance For background, my goal was to achieve an update frequency of about 20fps (or around 50ms per frame). Looking at the logs shown below, it's clear that this wasn't achievable with the initial design. The overall elapsed time for each frame is shown, along with a breakdown between computing the frame data and actually updating (drawing) the plots. Initially...