Fun Python widget to digitize circles on a grid
Hello friends,
This widget is a good introduction to making tcl/tk type widgets in Python.
The widget initializes with a grid of points, allowing you to draw a circle/ellipse as you wish on the screen. As soon as you finish drawing your circle/ellipse, it highlights the points on the grid closest to the boundary of the circle/ellipse you just drew.
There are 3 functionalities overall:
- highlight points in a grid that lie close to a circle
- select a bunch of points, create a best fit circle through them
- select a bunch of points, create a best fit ellipse through them (an extension of 2)
- tkinter
None, you only need the Python notebook file
Warning: "Double click" is used for clearing your selection. Running the cells will open a new tcl/tk widget window, so look out for that.
Thanks to http://www.java2s.com/Code/Python/GUI-Tk/Usemousetodrawashapeoncanvas.htm for the basic template and Jim Tieman for suggesting this exercise!
Enjoy!