This semester you will be writing a program that models elements of recognizing and creating characters. is an important area of research that allows photographs or printed documents to be digitized; by doing so, these documents are made available for machine-based searching. On the flip side, is a system for differentiating between humans and computers: the goal here is to generate a non-machine readable image that a human could identify. CAPTCHA helps reduce the amount of spam on the Internet.
<标题>We will implement a highly limited type of image matching, processing, and creation this semester. Rather than write this project at once, we will break the project down into
Implement a program that shall recursively draw a “tree” in a Tkinter Canvas.
The program shall consist of a non-resizable 500×500 px canvas in a non-resizable window and a menu bar. The menu bar shall have one pull-down menu named “Draw” with two items named “Repaint” and “Exit”.
<标题>The “Exit” menu item, when selected, shall gracefully terminate the program.
The “Repaint” menu item, when selected, shall clear the canvas and draw a recursive tree at random position growing “up” (in the direction 90°). The initial length of the stem shall be 128 px. The tree shall have the number of cascades selected uniformly at random between 3 and 7, inclusive.
One cascade of the tree of length L, growing from the position (X,Y) in the direction D, shall consist of (see the attached file):
- the stem represented as a black line segment of length L originating at (X,Y) and forming the angle D degrees with the horizonta axis, and
- two trees of length L*0.8, growing from the end of the stem in the directions