[Solved]Python36 Using Decisions Loops Lists File Reading 2d Drawing Design Implement Python Progr Q37133484
(Python3.6)
using only these: decisions, loops, lists, file reading and 2Ddrawing.
Design and implement a Python program that creates a drawingwindow, reads from a text file called draw.txt a list of 2Dgraphical instructions and executes them on the created window.Each line of the file represents a graphical instruction consistingof an operation name followed by a list of parameters. For example,the graphical instruction “Line 20 20 170 170” means draw a linefrom point (20, 20 ) to point (170, 170) where Line is theoperation and 20 20 170 170 are related parameters. Table.1describes the list of graphical instructions to include in thisassignment and Figure.1 shows a sample of draw.txt.
Your program should read each instruction, process it toidentify the graphical instruction and then execute it if corrector add the line number and an error message to a list of errors(called errorList) if there is an error in the graphicalinstruction. At the end, your program should display on the consolewindow, the number of errors found in draw.txt, followed by theline numbers they occur in and related error messages. Table.2includes the list of errors to consider, and Figure.2 shows thecorresponding outputs (drawing on the graphical window and errormessages on the console window).


this should be followed
Meaning Operation Parameters X0, YO, XI,YlDraw a line from point (XO, YO) to point (Xi, Y1) using current X0, Y0, W, H Line OColor Draw an oval whose bounding box’s top left corner is at position (XO, YO) and width and height given by W and H, using current OColor, and FColor Draw an rectangle whose top left corner is at position (X0, YO) and width and height given by W and H, using current OColor, and FColor Oval RectangleX0, YO, W, H Text FColor black, red, green, Set the filling color to black, red, etc. If no color is specified, filling OColorblack, red, green, Set the outline color to black, red, etc. If no color is specified, outline X0, YO, SZ, stringDraw string starting at position (X0, Y0) using the current OColor and a Font size SZ. blue, and magenta feature is cancelled blue, and magenta feature is cancelled Table1: Description of recognized instructions and their syntax Error Messages Meaning Wrong parameter t XO, YO, XI, Y1, W, H, or SZ are not integer Wrong number of parameters The number of parameters for instruction XXXX is wrong. where XXXX for XXXX could be oval, rectangle, etc Wrong color name for XXXX The color name for instruction XXXX is wrong (i.e. not among the list of names accepted by ezgraphics), where XXXX could be FColor or OColor The name of the instruction is not one of those mentioned in Table.1 Unknown instruction Table2: List of errors to consider COMP2101-SP2019: Homework#3 draw.txt FColor gray Rectangle 20 20 150 Rectangle 20 20 150 150 FCplor red Oval 20 20 150 150 0Color green Text 60.5 90 16 COMP2101 Text 60 90 16 COMP2101 0Color magenta Line 170 170 180 180 FColor gray 0Color black Rectangle 180 180 100 100 FColor blue Oval 180 180 100 100 OColor red Text 190 220 14 Homework#3 0Color magenta Line 280 280 290 290 FColor gray Circle OColor black Rectangle 290 290 50 50 FColor green Oval 290 290 50 50 FColor color oColor blue Text 295 310 12 SP2019 There are 4 errors List of errors: In line 2 Wrong Number of parameters for Rectangle In line 7 Wrong parameter type In line 21: Unknown instruction In line 26: Wrong color name for FColor Figure.1: Sample of draw.txt file Figure.2: Output of the program for draw.txt in Figure. 1 Show transcribed image text Meaning Operation Parameters X0, YO, XI,YlDraw a line from point (XO, YO) to point (Xi, Y1) using current X0, Y0, W, H Line OColor Draw an oval whose bounding box’s top left corner is at position (XO, YO) and width and height given by W and H, using current OColor, and FColor Draw an rectangle whose top left corner is at position (X0, YO) and width and height given by W and H, using current OColor, and FColor Oval RectangleX0, YO, W, H Text FColor black, red, green, Set the filling color to black, red, etc. If no color is specified, filling OColorblack, red, green, Set the outline color to black, red, etc. If no color is specified, outline X0, YO, SZ, stringDraw string starting at position (X0, Y0) using the current OColor and a Font size SZ. blue, and magenta feature is cancelled blue, and magenta feature is cancelled Table1: Description of recognized instructions and their syntax Error Messages Meaning Wrong parameter t XO, YO, XI, Y1, W, H, or SZ are not integer Wrong number of parameters The number of parameters for instruction XXXX is wrong. where XXXX for XXXX could be oval, rectangle, etc Wrong color name for XXXX The color name for instruction XXXX is wrong (i.e. not among the list of names accepted by ezgraphics), where XXXX could be FColor or OColor The name of the instruction is not one of those mentioned in Table.1 Unknown instruction Table2: List of errors to consider
COMP2101-SP2019: Homework#3 draw.txt FColor gray Rectangle 20 20 150 Rectangle 20 20 150 150 FCplor red Oval 20 20 150 150 0Color green Text 60.5 90 16 COMP2101 Text 60 90 16 COMP2101 0Color magenta Line 170 170 180 180 FColor gray 0Color black Rectangle 180 180 100 100 FColor blue Oval 180 180 100 100 OColor red Text 190 220 14 Homework#3 0Color magenta Line 280 280 290 290 FColor gray Circle OColor black Rectangle 290 290 50 50 FColor green Oval 290 290 50 50 FColor color oColor blue Text 295 310 12 SP2019 There are 4 errors List of errors: In line 2 Wrong Number of parameters for Rectangle In line 7 Wrong parameter type In line 21: Unknown instruction In line 26: Wrong color name for FColor Figure.1: Sample of draw.txt file Figure.2: Output of the program for draw.txt in Figure. 1
Expert Answer
Answer to (Python3.6) using only these: decisions, loops, lists, file reading and 2D drawing. Design and implement a Python progra… . . .
OR

