Ask Question
16 October, 22:14

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 ()

+3
Answers (1)
  1. 17 October, 00: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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers