Hallo Stefan,

thank you for the fast reply!
I was not aware of the lib you directed me to, but unfortunately it does not solve my problem.

With java-gnome I am able to develop gtk apps from java or even jython. My application is already developed, in python using gtk. Now I want to launch this application from jython. I know it is a weird usecase...
So what it boils down to is that I have to execute the lineа

PythonInterpreter.exec("import gtk");

I hoped this would work if I attach the java-gnome jar to the jython classpath, but it didn't.
Is there any way this can work? Maybe I don't understand what you mean by "translating the sources to jython"...

Cheers
Bastian
иииииииииииииииииииииииииииииииииииииииииии
Bastian Kennel

bastian.kennel@gmail.com
иииииииииииииииииииииииииииииииииииииииииии


On Mon, Oct 25, 2010 at 4:13 PM, Stefan Sonnenberg-Carstens <stefan.sonnenberg@pythonmeister.com> wrote:
Hi Bastian,

Java talks to the outside (C) world via JNI.
You cannot call gtk and such directly, when there is no
JNI interface for the library you are calling.

A proper workaround would be to use native java libs,
as swt (comes with jython) or swt/swing (comes with java).
Both are (IMHO) much more elegant than gtk, and there are
tons of examples everywhere (in java), which painlessly translate
into jython.

But you asked for it: http://java-gnome.sourceforge.net/
There you will find a Java to GTK/GDK binding.
You can translate the java sources to jython with ease.

Am Mo, 25.10.2010, 10:51 schrieb Bastian Kennel:
> hallo dear jython users,
>
> I have a framework developed in python that I have semi successfully
> ported
> to the java world by creating interfaces and implementing them via jython
> calls.
> Where my method fails is when I try to import anything related to guis
> (there are several guis in the framework).
>
> Now don't get me wrong, I don't want to programm a gtk gui using jython, I
> want to call an already programmed gtk guy through jython.
> When I call PythonInterpreter.exec("import gtk") I get:
>
> аFile "<string>", line 1, in <module>
> а File "/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py", line 30, in
> <module>
> а а import gobject as _gobject
> а File "/usr/lib/pymodules/python2.6/gtk-2.0/gobject/__init__.py", line
> 26,
> in <module>
> а а from glib import spawn_async, idle_add, timeout_add,
> timeout_add_seconds, \
> а File "/usr/lib/pymodules/python2.6/gtk-2.0/glib/__init__.py", line 22,
> in
> <module>
> а а from glib._glib import *
> ImportError: No module named _glib
>
> Is this a known boundary for jython to dive in the cpython world?
> If so, is there any way I can work around this issue?
>
> Cheers
> Bastian
> иииииииииииииииииииииииииииииииииииииииииии
> Bastian Kennel
>
> bastian.kennel@gmail.com
> иииииииииииииииииииииииииииииииииииииииииии
> ------------------------------------------------------------------------------
> Nokia and AT&T present the 2010 Calling All Innovators-North America
> contest
> Create new apps & games for the Nokia N8 for consumers in аU.S. and Canada
> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
> marketing
> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
> http://p.sf.net/sfu/nokia-dev2dev_______________________________________________
> Jython-users mailing list
> Jython-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jython-users
>


--
MfG,

Stefan Sonnenberg-Carstens

IT Architect
- Project management
- System analysis, design and build
- Security and business continuity
- IT risk management