please help I need to change the size of the window and the title window from user input lets say the user input 300 and tilte is cat these changes will apply to current script thank you import Gui3 def main(): win = Gui3.Gui() size = 100 canvas = win.ca(2*size + 50, 2*size + 50) canvas.rectangle([[-size, -size], [size, size]], fill=’yellow’) canvas.circle([0,0], size, fill=’green’) canvas.polygon([[-size, 0], [0, size], [size, 0], [0, -size]], outline=’black’, fill=’white’) win.title(‘title’) win.mainloop() main()
Expert Answer
Before the call to win.mainloop(), update the script to ask the user for a title for the window. Use the title method of the window object to change the title.
For the next part of the lab, ask the user to specify the size of the outer square. Use the input built-in function. You will need to make sure that the value is an int for it to be used by the Gui routines. You can simply cast it to int. If the user enters 200 for the size, the window should look like it does “right now”. That is, the size of the outer square is 200×200 in the code you downloaded.
Here’s what is looks like with size 100, 300.
Sample run
Here is an example of the user interaction for the minus version.
Enter a title: minus version
Enter the size for the square: 300
Notice that the title is the first question and the size is the second question.
This will produce this output window.
Check Version
For the check version, update the query so that the outer square could be rectangular. That is, ask for both a height and a width for outer rectangle.
Enter a title: check version
Width for the rectangle: 300
Height for the rectangle: 150
Once again, notice that the title is the first question, then the two dimensions for the window.