Since Dennis has X-No-Archive set on his posts, his very useful answer to Nicolae will be lost in a matter of days.
So I'm going to repeat it. Nicolae, Dennis found the fix is to change the example code. Read the documentation here: http://mcsp.wartburg.edu/zelle/python/graphics/graphics.pdf Download and install this file: http://mcsp.wartburg.edu/zelle/python/graphics.py Change the example to this: import graphics as g win = g.GraphWin() rect = g.Rectangle(g.Point(5, 10), g.Point(20, 30)) rect.draw(win) win.getMouse() which should run now. Thanks Dennis for your hard work identifying this! Dennis has more comments as well which you should read, quoted below. On Wed, 6 Apr 2016 12:01 pm, Dennis Lee Bieber wrote: > On Tue, 5 Apr 2016 17:17:54 +0100, Nicolae Morkov > <morkovnico...@gmail.com> declaimed the following: > >>I copied the code from Python from everyone page 67..... > > Which edition? There is now a second edition out (and I don't intend to > pay $70 for it just to assist a simple question) > >>Following the instructions The graphic modules by John Zelle I copied >>into the python lacation ,to be easier to find the path ..... >> > Which version? Did you also download the documentation (it runs around > 6 pages) for the library. The odds are very good that the library (v4 as I > recall) may have changed a lot from when a 1st edition book was written. > > Just downloaded > http://mcsp.wartburg.edu/zelle/python/graphics.py > and copied it into my Python installation Lib\site-packages directory > (actually -- all four, since I have Python 2.7 and [old] 3.3 in both 32 > and 64 bit variants on the machine). > > Using > http://mcsp.wartburg.edu/zelle/python/graphics/graphics.pdf > as a guide, I converted your example into > > -=-=-=- > > import graphics as g > > win = g.GraphWin() > rect = g.Rectangle(g.Point(5, 10), g.Point(20, 30)) > rect.draw(win) > win.getMouse() > -=-=-=- > > It runs! > > Note that the current version of that library is fully object-based -- > the rectange is defined by two corners which are represented by a pair of > Point objects -- and after the rectangle object has been created, one has > to tell /it/ to draw itself on the specified window. The getMouse() call > holds the program until you click the mouse in the window (technically it > returns a Point with the coordinates, but I'm throwing it away) -- Steven -- https://mail.python.org/mailman/listinfo/python-list