Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (41 sloc) 1.35 kb
import PyGML
import urllib
#this file is only for testing the library
def readFile():
#gmlFile = urllib.urlopen('http://000000book.com/data/154.gml')
gmlFile = open('SampleGML/147.gml', 'r')
gml = PyGML.GML(gmlFile)
gmlFile.close()
return gml
def createGML():
gml = PyGML.GML()
gml.client().set('name', 'PyGML')
gml.client().addKeyword('PyGML')
gml.client().addKeywords('test', 'python')
gml.client().setNowTime()
gml.environment().set('screenBounds', PyGML.Vect2d(480, 320))
stroke = PyGML.Stroke()
#stroke.setIsDrawing(False)
stroke.addPoint(0.0, 0.0)
stroke.addPoint(0.0, 1.0)
stroke.addPoint(1.0, 1.0)
stroke.addPoint(1.0, 0.0)
stroke.addPoint(0.0, 0.0)
brush = PyGML.Brush()
brush.set('color', PyGML.Color(255, 255, 255))
brush.set('width', 10)
stroke.setBrush(brush)
#stroke.info().set('curved', False)
gml.addStroke(stroke)
return gml
if __name__ == '__main__':
gml = readFile()
#gml = createGML()
print gml.client()
#print gml.client().get('name')
print gml.environment()
#print gml.environment().get('screenBounds').x
for stroke in gml.iterStrokes():
for point in stroke.iterPoints():
print point
gml.save('test.gml')
Jump to Line
Something went wrong with that request. Please try again.