Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stuck on assignment problem, really need help! Please make sure code runs correctly from tkinter import * #------------------------------------------- #------------------------------------------- # a) Makes one change to

Stuck on assignment problem, really need help! Please make sure code runs correctly

image text in transcribedimage text in transcribed

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") 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()
Assignment 5 Question 2 (10 marks): 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 a) Currently the title bar of the program window displays "AS Question 2 by. Add your username to the title bar ofthe program, ie, the title bar should display the string,-AS Question 2 by yourUsername,eg, AS Question 2 by afer023. Compsoi 201 2028 Assignment Rve b) Complete the get list of tuples from_fileffilename) 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 circlef 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 (di stance from the centre of the circle tothe edge of the cirdle) Assignment 5 Question 2 (10 marks): 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 a) Currently the title bar of the program window displays "AS Question 2 by. Add your username to the title bar ofthe program, ie, the title bar should display the string,-AS Question 2 by yourUsername,eg, AS Question 2 by afer023. Compsoi 201 2028 Assignment Rve b) Complete the get list of tuples from_fileffilename) 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 circlef 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 (di stance from the centre of the circle tothe edge of the cirdle)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

KEY QUESTION Refer to the table in question

Answered: 1 week ago