For my recent project I rewrote the basic Python file. I guess the first version was just a proof of concept, it was working but it had some trouble with i,j,x,y. In order to fix those I rewrote the program. Then when it was time to commit, I had to pick one change that was… Continue reading Rewrite with class
The task of packaging a Python application is not an easy one. But for my recent Python 2.7 project the Pyinstaller did the trick. pyinstaller -F –noconsole .py
In the previous post we discussed iterating through a list of lists for accessing values. But what about assigning values? Of course because of mutation the following code definitely works: but what about this one? It works also! And now, what about this one? No, that does not work! That’s an example of Python mutation… Continue reading Change a value in a list of lists
There are many ways to iterate through a list of lists in Python, this one is nice for some cases: but when there is no need for indexing the following will work perfectly:
Using tkinter I wanted to make something happen but only if the mouse moves from one square to the next. In order to do so, I wanted to have the square coordinates the mouse was clicked and compare it with the one it is now. The prevPos variable serves this purpose. It has a global… Continue reading The global local dipole
I wrote the following code to transform a series of comma separated numbers to alternating zeros and ones e.g. 4,3,4,3 is 00001110000111. But it could be so much better like so: My insight is that when the code goes bit by bit or character by character there must be a better way.
I used this code to flip a variable from 0 to 1 and vice versa: but stackoverflow suggests better ones, I prefer the following: