Question
in python
(27) TKinter : Draw a Stop Sign on a canvas. The Stop Sign is a regular octagon coloured red with a white STOP written in its
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

PYTHON CODE FOR 27:

from tkinter import *
import math
root=Tk()

canvas=Canvas(root,width=400,height=400)
canvas.pack()

points=[]
x=200
y=200
r=100
for i in range(0,8):
points.append(x+r*math.cos(2*math.pi*i/8))
points.append(y+r*math.sin(2*math.pi*i/8))

octagon=canvas.create_polygon(points,fill='red')
stop=canvas.create_text(200,200,fill="white",font="Times 40 bold",text="STOP")
root.mainloop()

output:

File main.py, line 4, in <module> root-Tk () File /usr/lib/python3 . 4/tkinter/ init--py, line 1854, in-init self.tk - _

Add a comment
Know the answer?
Add Answer to:
in python (27) TKinter : Draw a Stop Sign on a canvas. The Stop Sign is a regular octagon coloured red with a white STOP written in its center (28) TKinter : Write a GUI compound interest caleulat...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT