Ask Question

Given the following code, what are the dimensions, in pixels, of the shape created? import tkinter class myShape: def __init__ (self) : self. main_window = tkinter. Tk () self. canvas = tkinter. Canvas (self. main_window, width=200, height=200) self. canvas. create_rectangle (30,30, 175, 175) self. canvas. pack () tkinter. mainloop () shape = myShape ()

+5
Answers (1)
  1. 4 August, 09:35
    0
    Width: 145 px, Height: 145 px

    Explanation:

    To build a figure in Python with canvas, remember that drawing a rectangle is represented with self. canvas. create_rectangle (x1, y1, x2, y2), where x1, y1 are the coordinates of the top left corner of the figure, and x2, y2, the coordinates of the bottom right corner.

    Based on your data, the shape formed will not be a rectangle, but a square. The measures in x2, y2 are equal, so a square figure will form. For example, if you had (30,30,175,150) this would create a rectangle figure.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Given the following code, what are the dimensions, in pixels, of the shape created? import tkinter class myShape: def __init__ (self) : ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers