Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # By: Andrew Seemann
- from graphics import *
- def main():
- print("This program creates a scene from a given file")
- print()
- # Get the file
- infileName = input("What is the name of the text file?")
- infile = open(infileName, "r")
- # Line 1 - Window Size
- window = infile.readline().split(" ")
- windowWidth = window[0]
- windowHeight = window[1]
- # Line 2 - Coords
- coords = infile.readline().split(" ")
- coords1 = coords[0:2]
- coords2 = coords[2:4]
- # Window and Coords
- win = GraphWin("Test", windowWidth, windowHeight)
- win.setCoords(int(coords1[0]), int(coords1[1]), int(coords2[0])
- , int(coords2[1]))
- # Line 3 and beyond
- for line in infile:
- line = infile.readline()
- values = line.split()
- red = int(values[0])
- green = int(values[1])
- blue = int(values[2])
- xandy = values[3:]
- points = []
- for i in range(0,len(xandy),2):
- x = xandy[i]
- y = xandy[i + 1]
- aPoint = Point(x,y)
- points.append(aPoint)
- print(points)
- line = infile.readline()
- #polygon = points.getPoints()
- #polygon.setFill(color_rgb(red, green, blue))
- #polygon.draw(win)
- win.getMouse()
- win.close()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement