AttributeError : System.Drawing.Graphics is "read-only"

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

AttributeError : System.Drawing.Graphics is "read-only"

NikoVFR
Hello everybody...

first i apologize for my bad english... i did not practice for a very long time...

A strange problem in a ironpython app, done with Sharpdevelop...

I created a form, without borders, captions, icon...., just a simple square to draw...

When I try to draw from my OnPaint Function, IronPy answers me :
Exception.AttributeError :
attribute 'Graphics' of 'namespace#' object is read-only

Thanks for helping me, i really can't find any solution here...
Reply | Threaded
Open this post in threaded view
|

Re: AttributeError : System.Drawing.Graphics is "read-only"

Jimmy Schementi-2
Can you send the python code that causes this error?

~Jimmy


On Apr 18, 2011, at 7:56 AM, NikoVFR <[hidden email]> wrote:

>
> Hello everybody...
>
> first i apologize for my bad english... i did not practice for a very long
> time...
>
> A strange problem in a ironpython app, done with Sharpdevelop...
>
> I created a form, without borders, captions, icon...., just a simple square
> to draw...
>
> When I try to draw from my OnPaint Function, IronPy answers me :
> Exception.AttributeError :
> attribute 'Graphics' of 'namespace#' object is read-only
>
> Thanks for helping me, i really can't find any solution here...
> --
> View this message in context: http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%22read-only%22-tp31419737p31419737.html
> Sent from the IronPython mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Reply | Threaded
Open this post in threaded view
|

Re: AttributeError : System.Drawing.Graphics is "read-only"

Doug Blank
In reply to this post by NikoVFR
On Mon, Apr 18, 2011 at 7:56 AM, NikoVFR <[hidden email]> wrote:

>
> Hello everybody...
>
> first i apologize for my bad english... i did not practice for a very long
> time...
>
> A strange problem in a ironpython app, done with Sharpdevelop...
>
> I created a form, without borders, captions, icon...., just a simple square
> to draw...
>
> When I try to draw from my OnPaint Function, IronPy answers me :
> Exception.AttributeError :
> attribute 'Graphics' of 'namespace#' object is read-only

That usually means that you have misspelled an attribute. For example,
if you say Gtk.Wibbow instead of Gtk.Window, you'll get that error.
(It is actually a bad error message in that you are only looking up a
value, not creating one; is that only a Mono-only issue I wonder?)

As Jimmy says, we'd need to see the code to say more.

-Doug

> Thanks for helping me, i really can't find any solution here...
> --
> View this message in context: http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%22read-only%22-tp31419737p31419737.html
> Sent from the IronPython mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
_______________________________________________
Users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Reply | Threaded
Open this post in threaded view
|

Re: AttributeError : System.Drawing.Graphics is"read-only"

Markus Schaber-6
Hi, Doug,

We get the same misleading error message with IPy 2.6 on microsoft .NET 2.0.

Grüße,
Markus


> -----Ursprüngliche Nachricht-----
> Von: [hidden email] [mailto:users-
> [hidden email]] Im Auftrag von Doug Blank
> Gesendet: Montag, 18. April 2011 14:17
> An: Discussion of IronPython
> Cc: NikoVFR
> Betreff: Re: [IronPython] AttributeError : System.Drawing.Graphics
> is"read-only"
>
> On Mon, Apr 18, 2011 at 7:56 AM, NikoVFR <[hidden email]> wrote:
> >
> > Hello everybody...
> >
> > first i apologize for my bad english... i did not practice for a very
> > long time...
> >
> > A strange problem in a ironpython app, done with Sharpdevelop...
> >
> > I created a form, without borders, captions, icon...., just a simple
> > square to draw...
> >
> > When I try to draw from my OnPaint Function, IronPy answers me :
> > Exception.AttributeError :
> > attribute 'Graphics' of 'namespace#' object is read-only
>
> That usually means that you have misspelled an attribute. For example, if
> you say Gtk.Wibbow instead of Gtk.Window, you'll get that error.
> (It is actually a bad error message in that you are only looking up a
> value, not creating one; is that only a Mono-only issue I wonder?)
>
> As Jimmy says, we'd need to see the code to say more.
>
> -Doug
>
> > Thanks for helping me, i really can't find any solution here...
> > --
> > View this message in context:
> > <a href="http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%2">http://old.nabble.com/AttributeError-%3A-System.Drawing.Graphics-is-%2
> > 2read-only%22-tp31419737p31419737.html
> > Sent from the IronPython mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > Users mailing list
> > [hidden email]
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Reply | Threaded
Open this post in threaded view
|

Re: AttributeError : System.Drawing.Graphics is "read-only"

NikoVFR
In reply to this post by Doug Blank
class MainForm(Form):
    def MainFormPaint(self, sender, e):
                print "MainFormPaint %i"%self._paint
                gr = e.Graphics
                self.MainPanel.Draw(gr,0)

class MainPanel:
    def Draw(self,gr,starty):
                y = starty
                for c in self.Children:
                        y = c.Draw(gr,y)

Tell me if you need more code....

Edit : Calling a drawing fonction inside MainFormPaint works perfectly well, but not outside...
Reply | Threaded
Open this post in threaded view
|

Re: AttributeError : System.Drawing.Graphics is "read-only"

Markus Schaber-6
Hi, Niko,

A small self-contained running example would be nice.

I tried to guess some of the missing context, and now get the exception that MainForm has no _paint member.

Regards,
Markus


> -----Ursprüngliche Nachricht-----
> Von: [hidden email] [mailto:users-
> [hidden email]] Im Auftrag von NikoVFR
> Gesendet: Montag, 18. April 2011 15:31
> An: [hidden email]
> Betreff: Re: [IronPython] AttributeError : System.Drawing.Graphics is
> "read-only"
>
>
> class MainForm(Form):
>     def MainFormPaint(self, sender, e):
> print "MainFormPaint %i"%self._paint
> gr = e.Graphics
> self.MainPanel.Draw(gr,0)
>
> class MainPanel:
>     def Draw(self,gr,starty):
> y = starty
> for c in self.Children:
> y = c.Draw(gr,y)
>
> Tell me if you need more code....
> --
> View this message in context: http://old.nabble.com/AttributeError-%3A-
> System.Drawing.Graphics-is-%22read-only%22-tp31419737p31423875.html
> Sent from the IronPython mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[hidden email]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Reply | Threaded
Open this post in threaded view
|

Re: AttributeError : System.Drawing.Graphics is "read-only"

NikoVFR
Markus Schaber-6 wrote
Hi, Niko,

A small self-contained running example would be nice.

I tried to guess some of the missing context, and now get the exception that MainForm has no _paint member.

Regards,
Markus


> -----Ursprüngliche Nachricht-----
> Von: users-bounces@lists.ironpython.com [mailto:users-
> bounces@lists.ironpython.com] Im Auftrag von NikoVFR
> Gesendet: Montag, 18. April 2011 15:31
> An: users@lists.ironpython.com
> Betreff: Re: [IronPython] AttributeError : System.Drawing.Graphics is
> "read-only"
>
>
> class MainForm(Form):
>     def MainFormPaint(self, sender, e):
> print "MainFormPaint %i"%self._paint
> gr = e.Graphics
> self.MainPanel.Draw(gr,0)
>
> class MainPanel:
>     def Draw(self,gr,starty):
> y = starty
> for c in self.Children:
> y = c.Draw(gr,y)
>
> Tell me if you need more code....
> --
> View this message in context: http://old.nabble.com/AttributeError-%3A-
> System.Drawing.Graphics-is-%22read-only%22-tp31419737p31423875.html
> Sent from the IronPython mailing list archive at Nabble.com.
>
> _______________________________________________
> 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
Ok, problem solved, sorry you wasted your time for me....

I was just trying to create a System.Graphics.Font.....

Re-read it again and found...
Thanks whatever....