Page 210 - Programming With Python 3
P. 210

An Introduction to STEM Programming with Python — 2019-09-03a                              Page 197
            Chapter 19 — Better Graphics

            The die face is laid out like:

             Free








             eBook









             Edition








            Please support this work at



               1|  import graphics
                                  http://syw2l.org
               2|  import random
               3|  import time
               4|
               5|
               6|  def drawDie(window, n):
               7|      window.delete("all")                                    Free
               8|      if n == 2 or n == 3 or n == 4 or n == 5 or n == 6:
               9|          pip = graphics.Circle(graphics.Point(25,25),10)
             10|          pip.setFill("black")
                                                                   eBook
             11|          pip.draw(window)
             12|      if n == 6:
             13|          pip = graphics.Circle(graphics.Point(50,25),10)
             14|          pip.setFill("black")
             15|          pip.draw(window)
             16|      if n == 4 or n == 5 or n == 6:
             17|          pip = graphics.Circle(graphics.Point(75,25),10)
             18|          pip.setFill("black")
             19|          pip.draw(window)                      Edition
             20|      if n == 1 or n == 3 or n == 5:
             21|          pip = graphics.Circle(graphics.Point(50,50),10)


            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.
   205   206   207   208   209   210   211   212   213   214   215