tjvr / kurt

Python library for reading/writing MIT's Scratch file format.
https://kurt.tjvr.org
GNU General Public License v3.0
86 stars 24 forks source link

MultilineStringMorph has undefined properties #3

Closed bboe closed 11 years ago

bboe commented 12 years ago

Added text to a sprite to get the following example:

In [44]: vars(s.stage.sprites[0].images[1])
Out[44]: 
{'fields': {'compositeForm': <ColorForm(140x129)>,
  'form': <ColorForm(140x129)>,
  'jpegBytes': None,
  'mediaName': 'costume2',
  'rotationCenter': Point(92, 73),
  'textBox': <MultilineStringMorph()>},
 'version': 4}

In [45]: vars(s.stage.sprites[0].images[1].textBox)
Out[45]: 
{'fields': {'bounds': Rectangle([0, 0, 55, 39]),
  'color': TranslucentColor(0, 0, 0, 0),
  'flags': 0,
  'owner': None,
  'properties': None,
  'submorphs': [],
  'undefined-10': Color(361, 621, 806),
  'undefined-11': [u'foo'],
  'undefined-6': 0,
  'undefined-7': Color(1023, 1023, 1023),
  'undefined-8': [<#Helvetica Bold>, 24, True],
  'undefined-9': Color(0, 0, 0)},
 'version': 1}
tjvr commented 12 years ago

Aha! I hadn't realised MultilineStringMorph was used for anything. "undefined" is kurt's way of dealing with fields it can't name, without losing the data. I'll fix this next time I sync.

Thanks for pointing this out!

Out of curiosity, how are you getting this output?

bboe commented 12 years ago

Out of curiosity, how are you getting this output?

The output is from ipython. The commands I ran are on the In [N]: lines and the return value is displayed after the corresponding Out [N]: lines.

If instead you meant, what did you do to the scratch project to generate this output, basically you need to go into the sprite editor, and add some sort of text to the sprite. That should cover it.