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