10GRAPHICAL USER INTERFACES AND THE CANVAS

Image

Before we dive into simulations, we need to understand the basics of graphical user interfaces (GUIs). This is a massive topic, and we’ll barely scratch the surface, but we’ll see enough for us to present our simulations to the user.

GUIs typically consist of a parent window (or windows) containing widgets the user can interact with, such as buttons or text fields. For our goal of drawing simulations, the widget we’re most interested in is the canvas. In a canvas we can draw geometric primitives, and we can redraw them many times per second, something that we’ll use to create the perception of motion. ...

Get Hardcore Programming for Mechanical Engineers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.