Page 205 - Programming With Python 3
P. 205
An Introduction to STEM Programming with Python — 2019-09-03a Page 192
Chapter 19 — Better Graphics
Sets the width of the outline of a shape, in pixels.
Free
1| import graphics
2|
3| win = graphics.GraphWin("My Circle", 100, 100)
4|
5| c = graphics.Circle(graphics.Point(50,50), 10)
eBook
6| c.setFill("red")
7| color = graphics.color_rgb(255,255,0)
8|
9| c.setOutline("#f0a050")
10| c.setOutline(color)
11| c.setWidth(3)
Edition
12| c.draw(win)
13|
14| print("Click on popup window to close program.")
15| win.getMouse() # Pause to view result
16| win.close() # Close window when done
Please support this work at
http://syw2l.org
Additional Shapes and DrawingText
Free
l = Line(Point(x,y), Point(x,y))
graphics.Line(point, point) Shape class in graphics
Draw a line from one point to another.
eBook
r = Rectangle(Point(x,y), Point(x,y))
graphics.Rectangle(point, point) Shape class in graphics
Create a rectangle object with the first point being one corner and the second
Edition
point being the opposite corner. Typically, the points will be the top-left and
bottom right corners.
Copyright 2019 — James M. Reneau Ph.D. — http://www.syw2l.org — This work is licensed
under a Creative Commons Attribution-ShareAlike 4.0 International License.

