[elementary] How to get evas object out of elementary.Window

Carsten Haitzler (The Rasterman) raster at rasterman.com
Wed Sep 9 02:32:59 CEST 2009


On Mon, 24 Aug 2009 13:25:34 +0200 Laszlo KREKACS
<laszlo.krekacs.list at gmail.com> said:

correct. the c code works. to be honest - i work on the c. with the c. apps
too. i never look at the python so i have no idea what it is doing. but you did
the 100% right thing. check the c code and see what it's doing
api/behavior-wise. this is how it "should be". to be totally honest... it's
just as easy to use elm from as from python, so poking around the c api is
possible and easy.

> On Mon, Aug 24, 2009 at 10:52 AM, Laszlo
> KREKACS<laszlo.krekacs.list at gmail.com> wrote:
> > Unfortunately my C knowledge are almost nonexistant, so
> > maybe it will take some weeks to get there, writing a simple
> > demonstration application in C.
> 
> As others pointed out, the preferred way of doing C development is
> installing elementary on
> the desktop machine and develop on it (and crosscompile for the neo).
> 
> So I installed elementary, and ran the test application from here:
> http://trac.enlightenment.org/e/wiki/Elementary
> 
> Now, I modified the source, to get the evas canvas (evass), and print
> some info about
> it, and add other evas object to it, so not some elementary widget,
> but pure evas object.
> 
> In C, everything works as expected, evas_object_evas_get does return
> with a valid
> evas canvas object. And I can directly add other objects to it.
> In python this does not work.
> 
> For convenience, I post[1] my demonstration code (many thanks to
> devilhorns from #e).
> 
> What you are supposed to see, is a blue line(evas.Line) added over the
> Hello world!
> elementary label widget.
> 
> The next exercise would be to fix the python bindings. But I see these
> pyx, pxi, pxd files
> the first time in my life....
> http://trac.enlightenment.org/e/browser/trunk/BINDINGS/python/python-elementary/include/elementary
> 
> Best regards,
>  Laszlo
> 
> [1]:
> #include <Elementary.h>
> #include <Evas.h>
> 
> static void
> win_del(void *data, Evas_Object *obj, void *event_info)
> {
>    elm_exit();
> }
> 
> EAPI int
> elm_main(int argc, char **argv)
> {
>    Evas_Object *win, *bg, *lb, *lin;
>    Evas *evass;
>    int w = 0, h = 0;
>    char buf[4096];
> 
>    win = elm_win_add(NULL, "hello", ELM_WIN_BASIC);
>    elm_win_title_set(win, "Hello");
>    evas_object_smart_callback_add(win, "delete-request", win_del, NULL);
> 
>    evass = evas_object_evas_get(win);
> 
>    evas_output_size_get(evass, &w, &h);
>    printf("Width: %d\tHeight: %d\n", w, h);
>    //snprintf(buf, sizeof(buf), "lol: %d", evas_output_size_get
> (evass->changed); bg = elm_bg_add(win);
>    evas_object_size_hint_weight_set(bg, 1.0, 1.0);
>    elm_win_resize_object_add(win, bg);
>    evas_object_show(bg);
> 
>    lb = elm_label_add(win);
>    elm_label_label_set(lb, "Hello World!");
>    evas_object_size_hint_weight_set(lb, 1.0, 1.0);
>    elm_win_resize_object_add(win, lb);
> 
>    lin = evas_object_line_add(evass);
>    evas_object_line_xy_set(lin,10, 10 , 20, 30);
>    evas_object_layer_set(lin, 55);
>    // evas_object_clip_set(ob, panel_clip);
>    evas_object_color_set(lin, 0, 0, 255, 200);
>    evas_object_show(lin);
> 
> 
> 
> 
>    evas_object_show(lb);
> 
>    evas_object_show(win);
> 
>    evas_output_size_get(evass, &w, &h);
>    printf("Width2: %d\tHeight2: %d\n", w, h);
>    elm_run();
>    evas_output_size_get(evass, &w, &h);
>    printf("Width3: %d\tHeight3: %d\n", w, h);
>    elm_shutdown();
>    return 0;
> }
> ELM_MAIN()
> 
> _______________________________________________
> Openmoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    raster at rasterman.com




More information about the community mailing list