def to_dict(self): '''Save this location into a dictionary.''' return {'x': self.x, 'y': self.y, 'height': self.height, 'width': self.width, 'direction': dir.to_string(self.direction)}
def to_dict(self): '''Save this location into a dictionary.''' return { 'x': self.x, 'y': self.y, 'height': self.height, 'width': self.width, 'direction': dir.to_string(self.direction) }
def save_xml(self, doc, element): '''Save this location into an xml.dom.Element object.''' element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'x', str(self.x)) element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'y', str(self.y)) element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'height', str(self.height)) element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'width', str(self.width)) element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + 'direction', dir.to_string(self.direction).lower())
def __str__(self): return 'Position: {0}, {1}\nSize: {2}x{3}\nDirection: {4}'.format(\ self.x, self.y, self.width, self.height, dir.to_string(self.direction))