Ben Chuanlong Du's Blog

It is never too late to learn.

The Label Widget in Tkinter

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

General Tips

  1. ttk.Label is preferred over tk.Label.

Change the Text of a Label

After creating a Label (whose text has already been set), there are 3 different approaches that …

Use Tkinter to Build GUI Applications in Python

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Installation

Tkinter should be available by default after Python is installed. However, please continue read if you encounter the following error.

import _tkinter # If this fails your Python may not be …

Numpy Arrays in Python

Tips and Traps

  1. The Pythonic way of checking whether a collection (string, list, set, dict, etc.) coll is non-empty is to use if coll. However, do NOT use if arr to check whether a numpy array is non-empty or not. Instead, you shoule use arr.size >0 to check whether a numpy array is non-empty or not.

ModuleNotFoundError: No Module Named _Ctypes in Python 3.7

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Issue

The error message "Modulenotfounderror: No Module Named _Ctypes" is thrown when intalling packages in Python 3.7.

Cause

libffi-dev is needed to cleanly build Python 3.7.

Solution

  1. Remove Python …