quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryعلوم الحاسوب schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

Lab: Event Driven Windows Form App In this assignment, we will learn to use graphics objects and create GUI in a Python program. In this application, by using the Entry graphics variable, we are going to create a form similar to the following: Grade Calculator Student Name Physics Mathematics Computer Your grade information : Calculate (0, 0) k 3 unit (3,6) 6 unit In this window, you can setup a your own coordinate system by using the points (0,0) and (3, 6). By using this coordinate system we can then calculate the position of the graphics objects. For example, the location of the "Student Name" text variable can be defined at the location (1, 5.5). Similarly the location for the text entry object for the student name can be defined at point (2, 5.5) and so forth. Please follow the provided template file and write the remaining program in order to complete the requirements of the assignment. After drawing the graphics layout, we should use the getMouse function to capture a mouse event. When we receive the first mouse click then get the the floating point values for Physics, Mathematics, and Computer science and calculate their average. From this average we then calculate the grade for the student. Finally, we create an output text object variable and output a summary of the grade as the following: Grade Calculator Student Name James Physics 90 Mathematics 92 Computer 94 Your grade information : James your grade is: A Quit At the end, the application will wait for a second mouse click event. As soon as the second mouse event occurs the program will exit. In the lecture, we have discussed a similar example. Please review the example before you begin coding this assignment. # Program to dsisplay grade using GUI from graphics import * def main(): win GraphWin ("Grade Calculator", 600, 600) win.setCoords (0.0, 0.0, 3.0, 6.0) # Draw the interface Text (Point (1,5.5), "Student Name").draw(win) # name name Entry (Point (2,5.5), 20) name.setText("") name.draw(win) output = Text (Point (1,2.5),"") output.draw(win) button Text (Point (1.5,1.0), "Calculate") button.draw(win) Rectangle (Point (1,1.5), Point (2,0.5)).draw(win) # wait for a mouse click win.getMouse() # convert input # calculate average # determine grade # display grade # display output and change button output.setText("Your grade information goes here: ") button.setText("Quit") # wait for click and then quit win.getMouse() win.close() main()

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top