Re: Getting started with python?



On Thu, Jun 14, 2012 at 9:46 PM, Anders Dånmark
<anders danmark 83 gmail com> wrote:
> Hey!
>
> I've been googling around and cant find how to get started with
> libchamplain and python.
>
> I've tried to decode the c-code example with no luck.
>
> This is what I have so far.
>
> from gi.repository import GtkChamplain
> from gi.repository import Champlain
> from gi.repository import Gtk
>
> win = Gtk.Window()
> win.connect("destroy",Gtk.main_quit)
> wid = GtkChamplain.Embed???
> win.add(wid)
> Gtk.main()
>
> Can i get a nudge in the right direction?
>

Hello Anders,

sorry for the late reply. You may want to check the minimal.py example
from the demos directory. Basically the code looks this way:

from gi.repository import GtkClutter
GtkClutter.init([])
from gi.repository import GObject, Gtk, GtkChamplain

GObject.threads_init()
GtkClutter.init([])

window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
window.connect("destroy", Gtk.main_quit)

widget = GtkChamplain.Embed()
widget.set_size_request(640, 480)

window.add(widget)
window.show_all()

Gtk.main()

Make sure you really import and initialize GtkClutter like in the
example. Also check the launcher-gtk.py if you want a more advanced
example. There's currently no python-specific documentation so you may
need to guess the names of functions from their C equivalents. Let me
know if you need some more help.

Cheers,

Jiri


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]