[IronPython] Error Iterating

Curt Hagenlocher curt at hagenlocher.org
Fri Jan 22 05:08:08 CET 2010


You need to instantiate the InstalledFontCollection because "Families" is
not a static property.

>>> import clr
>>> clr.AddReference('System.Drawing')
>>> from System.Drawing.Text import InstalledFontCollection
>>> for f in InstalledFontCollection().Families:
...     print f.Name
...     break
...
Agency FB
>>>


On Thu, Jan 21, 2010 at 7:43 PM, David McWright
<david.mcwright at usbfmi.com>wrote:

> Hello All,
>   I'm working through a book and one of the exercise involves
> building comboBox filled with the names of the installed
> FontFamilies.  The code and error are:
>
> >>> import clr
> >>> clr.AddReference("System.Drawing")
> >>> from System.Drawing.Text import InstalledFontCollection
> >>> for f in InstalledFontCollection.Families:
> ...     print f.Name
> ...
> ...
> TypeError: iteration over non-sequence of type getset_descriptor
>
> The MSDN says that InstalledFontCollection.Families should be an Array
> of FontFamily objects which I thought I could step through.  What did
> I do wrong here?
>
> TIA,
> David
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100121/94d2a913/attachment.html>


More information about the Ironpython-users mailing list