PyDev of the Week: Jonathan Hoffstadt

This week we welcome Jonathan Hoffstadt (@jhoffs1) as our PyDev of the Week! Jonathan is the co-author of Dear PyGUI. It’s a neat, new Python GUI package. You can see what else Jonathan has been working on over on Github.

Let’s spend some time getting to know Jonathan better!

Can you tell us a little about yourself (hobbies, education, etc):

I’m a mechanical engineer based in Houston, Texas. I have a bachelor’s degree in Mechanical Engineering from Louisiana State University, was a Tow Gunner in the U.S. Marines, and I’ve been working in the oil and gas industry since I graduated university.

My hobbies include chess, shooting, and programming. With programming, I find 3D graphics to be extremely interesting.

Why did you start using Python?

I’d been interested in programming since middle school after I was given a C++ for dummies book as a gift, but I did not encounter Python until university. It was there that I started using Python as a free alternative to MATLAB for assignments. It wasn’t long before I was hooked on the language.

I started using it outside of homework for anything and everything I could. This included making small games, automating tasks at internships, controlling breadboards with raspberry pi’s, and everything in between. When compared to other languages, I was amazed at how quickly you could make things happen.

I ended up using Python for courses in Finite Element Analysis and Computational Fluid Dynamics. For our senior design capstone project, my team was tasked with building an Arc Welding 3D printer. As the member with the most exposure to programming, I was responsible for the software side of the project in which I used Python to control all the mechanical devices including a robotic arm and custom electronics the team created. I also wrote my first user interface which used tkinter and pygame to wrap an open source slicing engine and provide a 3D view of tool paths and the robotic arm position.

What other programming languages do you know, and which is your favorite?

C, C++, and Java are my other primary languages, though I’ve worked with C#, Swift, and Objective-C.

The truth is that I have 2 favorite languages. C++ for large projects. Python for small projects, scripting, and just getting things done!

What projects are you working on now?

I currently spend most of my time working on Dear PyGui.

Which Python libraries are your favorite (core or 3rd party)?

My favorite Python libraries would have to be NumPy, Pillow, tqdm, json, and Nuitka.

How did your package, Dear PyGUI, come about?

Dear PyGui is a graphical user interface library I coauthored with my friend, Preston Cothren. As mechanical engineers, we use python daily for calculations, scripts, and plugins for various software used in mechanical design and analysis. We wanted an easy way to add an interface to the various scripts with minimal effort.

The first iteration of the software was called “Engineer’s Sandbox” which was commercial. Not only was it easy to create small interfaces but it also made it easy to package and distribute. It came with a built in IDE and 60 premade apps. “Sandbox” was a C++ program that embedded python into it where the graphics were created with wxWidgets. Ultimately, this project was unsuccessful, gaining only a few hundred users. You can see an image of it below:

Engineer's Sandbox (precursor to Dear PyGUI)

Six months after abandoning Engineer’s Sandbox, we revisited the idea and reassessed. We came to 3 realizations:

1. Our primary target audience (mechanical engineers) were mostly uninterested in programming.

2. The software was too restrictive and limited for developers (our second target audience). Limited widgets, layouts, limited 3rd party operability, etc.

3. Most developers prefer using open source libraries.

From these realizations, we went back to the drawing board and decided to make a full GUI library. With this iteration being open source, a Python extension (instead of a standalone software), and as easy to use as possible.

Between iterations, we fell in love with the C++ library, Dear ImGui, and so decided to use it as underlying library to build around. With Dear ImGui being an immediate mode GUI library, it allowed us to make Dear PyGui extremely dynamic when compared to other UI libraries.

Dear PyGui has continued to rapidly improve and grow in popularity since we released the first open beta in July of 2020:

Dear PyGUI Examples

What are the top three things you’ve learned as an open-source developer?

As an open-source developer, I’ve learned that:

1. It’s hard work and will make you appreciate open-source software and developers.

2. Listen to the community but also know when to say “no”.

3. Funding is difficult to find, so you should enjoy the work you are doing.

Is there anything else you’d like to say?

Yes! This is for those new to programming. I’m often asked how to learn a programming language, library, topic, etc. and my answer has always been: The best way to learn anything in programming is to just start building things.

I typically skim a book then immediately start trying to build something. As I get stuck, I go back to the book to read the relevant sections more closely. Once it’s time to refactor and optimize, I typically go back to the book and read the more advanced sections now that I’m more aware of the issues that the advanced sections try to address. I’ve found this technique helps me a lot. Although you may end up reinventing the wheel by saving the advanced topics for after you’re done, you will end up with a deeper understanding that you are unlikely to forget.

Thanks for doing the interview, Jonathan!