[IronPython] TypeError: expected Size, got Size

Lukas Cenovsky cenovsky at bakalari.cz
Mon Jul 19 17:57:00 CEST 2010


  On 19.7.2010 17:11, Ian Hobson wrote:
> Hi all,
>
> Will some kind soul please point me to a decent explanation of 
> Assemblies, NameSpaces
> CLR references and the from X import Y command from an IronPythin 
> perspective?
>
> I'm utterly fed up of getting errors like this one.
>
> When I use
>
> from System.Drawing import Size
>
> I get the ultra-informative error message in my subject line.
>
> I am trying to translate the following line from c#
>
> worksOrder.Measure(new Size(printDlg.PrintableAreaWidth, 
> printDlg.PrintableAreaHeight));
>
> worksOrder is a Grid, printDlg is a printDialog.
>
> I have...
>
> worksOrder.Measure(Size(printDlg.PrintableAreaWidth, 
> printDlg.PrintableAreaHeight))
>
> And I need to know how to find out where I can get the correct 
> definition of Size.

Grid is UIElement and you need System.Windows.Size for UIElement.Measure 
- not System.Drawing.Size. See 
http://msdn.microsoft.com/en-us/library/system.windows.uielement.measure.aspx.

--
-- Lukáš




More information about the Ironpython-users mailing list