python3 describes a GUI programs(tkinter) that draw a rectangle and/or an oval,
ID: 3597304 • Letter: P
Question
python3 describes a GUI programs(tkinter) that draw a rectangle and/or an oval, as shown the figures belows. The user selects a figure from a radio button and specifies whether it is filled by selecting a check button. A regular button is used to clear all drawings on the canvas. When the Rectangle radio button is clicked, the program checks if the Filled check button is checked to decide whether or not the rectangle should be filled. It then draws a rectangle with top_left corner at (50,50) and bottom_right corner at (250,250). When the oval radio button is clicked, the program checks if the Filled check button is checked to decide whether or not the oval should be filled. It then draws an oval "bounded by an imaginary rectangle" with corners at (50,100) and (250, 200). Use red fill color for the rectangle and yellow fill color for the oval. When the Clear button is clicked, all drawing on the canvas will be cleared and all buttons will be unchecked. Use nested frames to achieve the shown layout where all buttons are added to a pane/frame that is added to the main frame. Start with __init__ method using class. GUls drawing geometric shapes C Rectangle Oval Filled Clear shapes_1.jpg shapes_2.jpg shapes_3.jpg This drawing resulted from the user clicking the Filled check button, followed by clicking the Rectangle radio button, followed by clicking the oval radio button. Start with __init__ method using class.
This drawing resulted from the user clicking the Filled check button, followed by clicking the Rectangle radio button, followed by clicking the oval radio button.
GUls drawing geometric shapes C Rectangle Oval Filled ClearExplanation / Answer
from Tkinter import *
master = Tk()
shape = IntVar() # ensure you use an instance of IntVar
Radiobutton(text='Circle', variable=shape, indicatoron=0, value=1, master=master).pack()
Radiobutton(text='Rectangle', variable=shape, indicatoron=0, value=2, master=master).pack()
to draw a circle
import pythongame, system
pythongame.init()
screen=pygame.display.set_mode([640,480])
screen.fill([0,0,255])
pythongame.draw.circle(screen,[300,0,0],[100,100],50,0)
pythongame.display.flip()
while True:
for event in pythongame.event.get():
if event.type==pythongame.QUIT:
system.exit()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.