You get to draw some polygons just by mouse clicks or you can draw circles with given center and radius. UI is made simple and convenient, even for a novice.
Pip3 Modules required:
PyQt5, Matplotlib, Numpy
- Run the code with command python3 polygon.py
- Click on 'Button:Draw a polygon', to draw a polygon
- A new plain window appears, with help of mouse, click(right (or) left) on the screen and points will be appeared as dots on the screen.
- Now after completion, press 'CTRL+R' or Run action from the file menu to plot the polygon
- Use 'CTRL+Q' to exit from this window.
- Click on 'Button:Draw a circle', to draw a circle.
- A new window appears where you will be prompted to enter, x-coordinate and y-coordinate of center of circle and also radius of circle.
- Click on 'Button:Click here to plot', to display plot of required circle.
- If the requirement is completed you can close the window by clicking default close window feature.
- Click on 'Button:Multiple plots', to draw multiple polygons and circles on the same plot.
- A new window pops up where you can add a circle (or) polygon to the plot, and also clear the plot.
- If you click on 'Button:Add a circle', a new text editor window pops up where you can enter required circle info, in 'x','y','r' format and save file by CTRL+S as 'circle.txt'. Add as many circles as required.
- Use 'CTRL+Q' to exit from this window.
- Similarly, if you click on 'Button:Add a polygon', a new text editor window pops up where you can enter required polygon info, in 'x','y' format and save file by CTRL+S as 'polygon.txt'. Add as many vertices as required.
- Use 'CTRL+Q' to exit from this window.
- Click on 'Button:Plot', to display plot of added circles and polygon.
- Use 'CTRL+O' to open and edit existing text files, 'circle.txt' and 'polygon.txt'.
- Output plot will be circles and polygons, where the area of circles will be shaded.
- Click on 'Button:Clear', to clear the plots and also the text files.
- Use 'CTRL+Q' to exit from this window.