1. Create a game
I bet you never considered creating a game with Python. But why not? There are awesome libraries that will help you develop games. So let’s help your kids, your partner, or your colleagues get through this crisis with a fun game!
Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries. Here are a few tutorials you can try:
- Making Games with Python & Pygame
- Game development with Pygame
- The official getting started guide (note: as of writing, the site is down so I linked to a “Wayback machine” version instead)
Panda 3D is a game engine that includes graphics, audio, I/O, collision detection, and other abilities relevant to the creation of 3D games. Its core is written in C++, so it’s very fast. Lucky for us, we can use the library from Python!
Panda3D has been used to create commercial games as well as some open-source ones. If you always wanted to dive into 3D game programming, this is the time. Start with the official manual.
2. Build a website
This one is a little less original, sure, but it is a very important skill to have! There are several frameworks that help you build a Python-based website. One of the most well know is Django. It’s very extensive and can be used to create complex websites. You can start with the official tutorial, It’s excellent.
Another option is Flask. It’s more lightweight and easier to start with while offering enough to create a relatively simple website.
Once you’ve got the basics, here are some ideas to try:
- Your own blog
- A simple online shop
- A shopping list
- A database of jokes or inspirational quotes
3. Create a GUI with Tkinter
Python has a powerful base library to create GUI applications. Many people, including me, use Python mostly for scripting and for backend code. But there are actually quite a few Python GUI applications too!
One thing to note is that
tkinter has been around for a while. Many tutorials you’ll find are written for Python 2. You can quickly recognize these tutorials because they use Tkinter (with capital T), like this:
# don't follow tutorials that start with:
While more recent tutorial will use the new, lower-case library name:
# Look for this instead:
A nice tutorial to get you started can be found here.
Here are a few ideas you can build once you mastered the basics:
- A To-Do application
- A notes application
- A calculator
- A weather app (see tip #5 as well)
4. Build a jokes web service
Another useful skill to possess is the ability to create web services using Python. There are several frameworks that make this task super easy. These are the most recommended ones:
- Falcon is completely focussed on creating web APIs. It’s very fast.
- Flask is a lightweight web framework, which is also suitable for creating services.
You can pick either. An advantage of Flask is it's multi-purpose: you can also use it to create websites.
An idea to get you started is to build a web service that serves jokes. For this purpose, I would recommend diving into
sqlite3 as well.
5. Fetch data from the web
Python is ideal for fetching information from the web. There are some terrific libraries that will do all the grunt work for you. I’ll list my top 3 here.
Requests is a Python HTTP client. It makes web requests really simple. Many people prefer it over the other available options.
Just to show how easy
requests can be, here’s some example code:
If you want to fetch more than a couple of fixed URLs, you should look into Scrapy. It can be used to build a full-fledged web spider, that can discover new pages on its own within set limits.
Once you’ve pulled some HTML from a website, you need to parse it to get what you actually need. Beautiful Soup is a Python library for pulling data out of HTML and XML files. It is very powerful and is able to handle all kinds of HTML, even if it’s broken.
6. Explore some cool tricks and libraries
If you don’t feel like building something yourself right now, you can explore some cool Python tricks and libraries instead. I wrote two articles that will serve this purpose.
The first one is a list of the most used Python packages in the world:
The 22 Most-Used Python Packages in the World
Educational and surprising insights into how Python is used
The second is a list of best practices, tips, tricks, and some very nice Python packages:
That’s it — thanks for reading and happy coding! If you liked this, follow me on Twitter to keep up with my latest work.