Re: [IronPython] Error Iterating

2010-01-21 Thread David McWright
Curt & David,
   Thanks for the help!  Should have figured that one out. :)

On Jan 21, 11:08 pm, David DiCato  wrote:
> You need to instantiate InstalledFontCollection in order to use its Families 
> field directly. The code sample you sent gets Families from the type 
> InstalledFontCollection, rather than an instance thereof, and thus tries to 
> iterate over a property descriptor. Try the following:
>
> >>> for f in InstalledFontCollection().Families:
>
> ...     print f.Name
> ...
>
> Good luck,
> - David
>
> -Original Message-
> From: users-boun...@lists.ironpython.com 
> [mailto:users-boun...@lists.ironpython.com] On Behalf Of David McWright
> Sent: Thursday, January 21, 2010 7:44 PM
> To: us...@lists.ironpython.com
> Subject: [IronPython] Error Iterating
>
> 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
> us...@lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
> ___
> Users mailing list
> us...@lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Error Iterating

2010-01-21 Thread David DiCato
You need to instantiate InstalledFontCollection in order to use its Families 
field directly. The code sample you sent gets Families from the type 
InstalledFontCollection, rather than an instance thereof, and thus tries to 
iterate over a property descriptor. Try the following:

>>> for f in InstalledFontCollection().Families:
... print f.Name
...

Good luck,
- David

-Original Message-
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of David McWright
Sent: Thursday, January 21, 2010 7:44 PM
To: users@lists.ironpython.com
Subject: [IronPython] Error Iterating

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@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Error Iterating

2010-01-21 Thread Curt Hagenlocher
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
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@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Error Iterating

2010-01-21 Thread David McWright
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@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com