On Sat, 2013-04-20 at 13:40 +0200, Donn wrote:
> A follow-up.
> 
> Progress
> --------
> In the python file (test.py) I got the idea to explicitly call the new() 
> method of the RedSquare object. I saw it when I did a dir() in Python.
> 
> (I first got the idea when I saw how a Clutter.Color was instanced - 
> with Clutter.Color.new() - in Python, this is deeply weird.)
> 
> New Python line 22
> rs = Palelib.RedSquare.new()
> 
> Then restore the this.canvas.invalidate() call in the vala code under 
> boo(), build it - and the red square appears!
> 
> Nice. Odd, but nice.

Just so you know, what's probably happening is that PyGI was using
g_object_new instead of the constructor you created in Vala.  When
you're writing a library, especially one meant to be consumed from
languages other than Vala, it's generally a good idea to use
GObject-style construction [1].  In your original example, simply
replace "public RedSquare()" with "construct" and it should work as
expected.

[1] https://live.gnome.org/Vala/Tutorial#GObject-Style_Construction


-Evan

_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to