Question:
Why won't my Python Graphics Window open?
Me
2010-12-23 17:20:09 UTC
Can any one help i am running 3.1.2 for homework at my school this program works but at home on my Window XP it gives me the error code



Traceback (most recent call last):
File "C:\house win", line 2
from graphics import *
ImportError: No module named graphics
I am kind of new to programing but what annoys me is the face that it will work on my school computers just not on my own???


I checked every little thing but that error code just pops up. Would Love help no sarcastic answers please. Here is my syntax

### Open a graphics window
from graphics import *
def main():
win = GraphWin()
### draw a black Rectangle at point (90, 130), Point (130,170)
rect = Rectangle(Point(80, 140), Point(120, 180))
rect.setFill("Red")
rect.draw(win)
### draw a line segment using a line object
line = Line(Point(0, 181) , Point(240,181))
line.setFill("green")
line.draw(win)
grass = Rectangle(Point(0, 181), Point(240, 240))
grass.setFill("green")
grass.draw(win)
door = Rectangle(Point(95, 165), Point (105,180 ))
door.setFill("black")
door.draw(win)
skyone = Rectangle(Point(0, 0), Point(240, 139))
skyone.setFill("light blue")
skyone.draw(win)

win.getMouse()
win.close()

Trying to make a house please help need it done by the new year AAAAAAAAARRRRRRRRRRRRG please tell me what python is doing and why it is giving me that annoying syntax error Thanks for the help
Four answers:
2010-12-23 17:25:48 UTC
Download this, you require a library file for basic graphics.

http://mcsp.wartburg.edu/zelle/python/graphics.py
Erika
2016-11-15 05:45:53 UTC
Python Graphics Module
2010-12-23 17:24:59 UTC
"ImportError: no module named graphics"



This means you don't have all the files you need, or python can't find them. Probably, your teacher has given you files and you haven't set them up properly, or you're assuming you can do work at home when you need extra files that are only on the school computers.



Seems this is the graphics module you're missing, but I don't know where the files would be. You should just ask your teacher, or check your notes.



http://mcsp.wartburg.edu/zelle/python/graphics/graphics/



Another thing to check/fix is the folder name: "house win" -- do NOT use spaces in folder names or file names. At least, not with python and other cross-platform software. It's just a bad idea.
2016-12-03 06:55:09 UTC
confident you ought to proceed, i think of there is somewhat few distinction in the two variations in terms of ways it works. in case you come across some ameliorations you ought to unquestionably undertake it. and the generic handbook have the section "whats new". you're you able to this to be attentive to greater.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...