Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is python Please help me out Write a GUl program that draws a roctangle and

ID: 3677987 • Letter: T

Question

This is python Please help me out Write a GUl program that draws a roctangle and or an oval, as shown in the fipues belos The user selects a figure fron a tadio butloa and speciies whether i is falled by selocting a check bunoa Aregular buton is used so clear all drawings on the canvas When the Rectanple radio button is clickod, the program checks if the Filed chock buton is checked to decide whether or sot the scashould be filled. It then draws a rectangle with op left comer at (50.50) and botom_right com a (250,250 Whon the oval radio buton is clicked, the program checks if the Filled check buflon is checked to decide whether or the oval should be filled It then draws an oval "bounded by an imaginary rectangle" with comers at (50,100) and (250, 200 Use red fill cellor for thc rectangle and yello" fill color for the oval when the Clar bution is clicked, all áawag on caavas will be iPad 47% . ) will be unchecked Use nosted frames to achieve the shown layout whene all butors are added to a pano frame that is added to the main frame This drawing reselted fom the usr clicking the button, ollowed by clicking Filled check baton button, followed by clicking he Rectangle radio betton al radio buttion

Explanation / Answer

from Tkinter import Tk, Canvas, Frame, BOTH


class Geometric(Frame):
  
def __init__(self, parent):
Frame.__init__(self, parent)   

self.parent = parent
self.initUI()
  
  
def initUI(self):
  
self.parent.title("Shapes")
self.pack(fill=BOTH, expand=1)

canvas = Canvas(self)
canvas.create_oval(10, 10, 80, 80, outline="gray",
fill="gray", width=2)
canvas.create_oval(110, 10, 210, 80, outline="gray",
fill="gray", width=2)
canvas.create_rectangle(230, 10, 290, 60,
outline="gray", fill="gray", width=2)
canvas.create_arc(30, 200, 90, 100, start=0,
extent=210, outline="gray", fill="gray", width=2)
  
points = [150, 100, 200, 120, 240, 180, 210,
200, 150, 150, 100, 200]
  
canvas.pack(fill=BOTH, expand=1)


def main():
  
root = Tk()
ex = Geometric(root)
root.geometry("330x220+300+300")
root.mainloop()


if __name__ == '__main__':
main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote