Superscript in Python plots

You just need to have the full expression inside the $. Basically, you need “meters $10^1$”. You don’t need usetex=True to do this (or most any mathematical formula). You may also want to use a raw string (e.g. r”\t”, vs “\t”) to avoid problems with things like \n, \a, \b, \t, \f, etc. For example: … Read more

How do I add two sets?

All you have to do to combine them is Sets are unordered sequences of unique values. a | b or a.union(b) is the union of the two sets (a new set with all values found in either set). This is a class of operation called a “set operation”, which Python sets provide convenient tools for.

Trying to run Flask app gives “Address already in use”

It means there’s another service’s using that port (8080 in this case). Maybe because you forgot close another running Flask app and it’s using 8080 port. However, you could change the port you’re using, for example change it to 4444 like this: But anyways, I think you’d like to know which program is using that … Read more

Python official installer missing python27.dll

At least for the ActiveState Python distribution, and in the official Python distribution: The dll is in where NN is the version number. On a 64-bit, a 32 bit dll will be installed here: and a running 32 bit application will magically translate this to the proper path, http://en.wikipedia.org/wiki/WoW64 When I link againsy Python27, I … Read more

How to clear Tkinter Canvas?

Every canvas item is an object that Tkinter keeps track of. If you are clearing the screen by just drawing a black rectangle, then you effectively have created a memory leak — eventually your program will crash due to the millions of items that have been drawn. To clear a canvas, use the delete method. … Read more