Re: [Vala] Vala in Python - Some progress and a question
- From: Evan Nemerson <evan coeus-group com>
- To: Donn <donn ingle gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Vala in Python - Some progress and a question
- Date: Sat, 20 Apr 2013 12:14:38 -0700
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]