views:

36

answers:

0

I'm putting together a swing gui, in Jython, and wish to use a processing PApplet.

So I do something like

from processing.core import *

class ProcessingApp(PApplet):
    def __init__(self):
        PApplet.__init__(self)
        #...
    def setup(self):
        #...
    def draw(self):
        #...

and then later on in the module, I define a JPanel, which is used normally

class ProcessingPane(JPanel):
    def __init__(self):
        JPanel.__init__(self)
        self.setLayout(BorderLayout())
        embed = ProcessingApp()
        self.add(embed, BorderLayout.CENTER)
        embed.init()

And everything works as expected. However, if I move the ProcessingApp class to a different module and replace the first snippet by from foo import ProcessingApp, the behaviour changes.

In particular, the sketch does not update when my mouse moves. (While it does when inlined.)

But it does receive mouse events, since clicking on it will successfully get a message to the console.

I'm wondering where this bug is coming from (there's a lot of elements involved here, and I'm a bit lost as to how I could root it out)

[EDIT]: I've extracted other elements of the gui (A JScrollPane with Jtree, etc...) to modules of their own and they seem to work fine.