Any characters not supported by display should simply be skipped on output.
Your program should print out the letters horizontally, and go to a new "line" when you input a space. Thus, each 'word' will be on a different line. Also, make certain you leave some space between each letter.
Your program should be completely structured and use at least three levels of functions - as described below.
First, here is an example of the fourteen segments all displayed at once. (Note
that your version does NOT have to have points at the end of the segments:
They can simply be straight lines.)
You should produce functions for each letter, for each number and for the 'space' character. For example, the function for A would not directly call its seven segments directly, but would be composed of perhaps four further calls:
def MethodA (width) : top_stroke(width)middle_stroke(width)left_stroke right_stroke(width) |
Note that the *width* of a character needs to be sent to any function which is dependent upon it. If you define the lower-left
corner as the "home position" for the turtle, it does *not* need to know the width of the letter to draw the left_stroke, but
it *does* need to know the width to draw the right_stroke in order to position properly.
The code for right_stroke might look like:
def right_stroke(width): top_right(width) bottom_right(width) |
Finally, bottom_right would actually call the turtle graphics routines and at long last draw a single line.
def bottom_right(width): *some turtle graphic functions* |
On the other hand, the letter "H" would be produced by the following sequence:
Def MethodH( width) : right_stroke(width) left_stroke middle_stroke (width) |
Hint: Always make your turtle go back to the same point (say, the lower-left) after drawing each stroke.
That way, the order of the strokes will not matter!
So, if your data file contains: 108 (the width of the character!) PYTHON IS FUN The output should look like: