from tkinter import Tk, Canvas
frame=Tk()
canvas=Canvas(bg='black',height=250,width=300)
coord=(100, 100, 200, 200)
canvas.create_arc(coord,start=0,extent=90,fill='white')
canvas.create_arc(coord,start=90,extent=90,fill='blue')
canvas.create_arc(coord,start=180,extent=90,fill='white')
canvas.create_arc(coord,start=270,extent=90,fill='blue')
canvas.pack()
frame.mainloop()
In the Package Explorer view, select the the current working pydev project i.e. week1lab and click the New > Source Folder... to create a source folder "src", click the New > Pydev Module... in the toolbar. In the Package and Name field, select src and type bmw. Click Finish and Select <empty> from the Template menu.
bmw.py is opened in the editor which contains the default header comments. Finish the program by copy the code from above. Save and run the module to see your output.
You can open any file in the project explorer by double clicking on it. Or create a new PyDev module i.e. File > New > PyDev Module. Notice the syntax highlighting. Different kinds of elements in the Python source are rendered in unique colors. Examples of Python source elements that are rendered differently are:
Multiple lines '''...''' comments
inline # comments
Keywords and String
In the Package Explorer view, find tester and double-click it to open it in the editor.
Select the programe which will make use of arguments as input i.e quadratic.py, select Run Configuration... under Run Menu
from tkinter import Tk, Canvas
frame=Tk()
canvas=Canvas(bg='black',height=250,width=300)
coord=(100, 100, 200, 200)
canvas.create_arc(coord,start=0,extent=90,fill='white')
canvas.create_arc(coord,start=90,extent=90,fill='blue')
canvas.create_arc(coord,start=180,extent=90,fill='white')
canvas.create_arc(coord,start=270,extent=90,fill='blue')
canvas.pack()
frame.mainloop()
The Canvas class supports more than canvas.create_arc() methods to draw arc or pieslice. Other methods include
create_line(),create_oval(),create_polygon(), create_rectangle(), and create_text(). Modify the program above to draw a rectangle and print your name with a line drawn underneath.
python loantable.py 300 12 100
" in command prompt console will produce an output as follows:
The loan amount is : 300 The annual interest rate is: 12 The monthly payment is: 100 Starting Middle Ending Month Balance Payment Balance Interest Balance ------------------------------------------------------- 1. 300.00 100.00 200.00 2.00 202.00 2. 202.00 100.00 102.00 1.02 103.02 3. 103.02 100.00 3.02 0.03 3.05 4. 3.05 3.05 0.00 0.00 0.00Modify the program to write output into a file using HTML, upload file "output.html" to github after you finished.