Question: OUTPUT: QUESTION SKELETON: from tkinter import * #------------------------------------------- #------------------------------------------- # a) Makes one change to the main() function #------------------------------------------- def main(): canvas_width = 600 canvas_height

 OUTPUT: QUESTION SKELETON: from tkinter import * #------------------------------------------- #------------------------------------------- # a)

Makes one change to the main() function #------------------------------------------- def main(): canvas_width =

OUTPUT:

600 canvas_height = 600 window = Tk() window.title("A5 Question 2 by xxxx")

QUESTION SKELETON:

from tkinter import *

#------------------------------------------- #------------------------------------------- # a) Makes one change to the main() function #------------------------------------------- def main(): canvas_width = 600 canvas_height = 600

window = Tk() window.title("A5 Question 2 by xxxx") geometry_string = str(canvas_width)+"x"+str(canvas_height)+"+10+20" window.geometry(geometry_string)

a_canvas = Canvas(window) a_canvas.config(background="misty rose") a_canvas.pack(fill=BOTH, expand = True) #Canvas fills the whole top level window

centre_x = 300 centre_y = 300 radius = 250

circle_pts = get_list_of_tuples_from_file("CircumferencePoints.txt") draw_outer_circle(a_canvas, centre_x, centre_y, radius) draw_cardioid_connections(a_canvas, circle_pts)

window.mainloop() #------------------------------------------- #------------------------------------------- # Reads the list of points from the file # (each point is a tuple of two integers) # b) Complete the get_list_of_tuples_from_file() function #------------------------------------------- def get_list_of_tuples_from_file(filename): pass #------------------------------------------- #------------------------------------------- # Draws the connecting lines of the cardioid # c) Complete the draw_outer_circle() function # d) Complete the draw_cardioid_connections() function #------------------------------------------- def draw_outer_circle(a_canvas, centre_x, centre_y, radius): colour = "medium purple"

def draw_cardioid_connections(a_canvas, points_on_circumference): colour = "medium orchid"

main()

This program reads points from a text file and creates a String Art cardioid pattern by drawing a series of lines between the points. For this question, you may use any colours of your choosing b) Complete the get list of_tuples from_file(filename) function Complete the get_list of_tuples_from file) function which is passed the name of a file as a parameter. Each line of the file contains two floating point numbers separated by spaces. The function reads the information from the file and returns a list of tuples. Each tuple in this list of tuples is made up of the two numbers taken from each line of the input file and rounded to the nearest whole number. The function returns the list of tuples c) Complete the draw_ outer_circle(a_canvas, centre x, centre_y, radius) function. Complete the draw outer circle(function. This function is passed four parameters: the Canvas object and three integers (the centre x position, the centre y position and radius of a circle). The function draws the circle in the given position and of the given radius (distance from the centre of the circle to the edge of the circle) d) Complete the draw_cardioid connections(a_canvas, points_ on_circumference) function. Complete the draw cardioid connections() function which is passed two parameters: the Canvas object and a list of tuples each made up of two integers representing a point on the circumference of a circle (circle outline). The function draws ALL the lines connecting the points in the list of tuples in the way described below. Please read the two Important Notes lower down on this page point number 1 connects to point number 2, point number 2 connects to point number 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!