Events for OnscreenImage?

I need a function to be called when the mouse cursor is over the image. I tried

a = OnscreenImage(image="data/models/cog_attacks/mini/{0}_{1}.png".format(track,attack),
                                   pos=Vec3(_x,0,_y),parent=openI,scale=.1)
                
a.bind(DGG.ENTER,lambda:_setT(track,attack))

I get ‘OnscreenImage’ has no attribute ‘bind’.

I believe that bind is for DirectFrames only, but using frames is not an option.

Why is using DirectFrame not an option? Anything you can do with OnscreenImage, you can do with DirectFrame. In fact, DirectFrame simply wraps OnscreenImage, and then adds the ability to detect mouse movement over the image, which is precisely the feature you say you need.

If you just mean you don’t want a visible background or border, pass relief = None to the DirectFrame constructor.

David

Ok, so I finally got to “put” an image inside a frame, but the events now are the problem.


for track in xrange(5):
            for attack in xrange(5):
                _x = -.15+.232*attack
                _y = .52-.285*track
                
                f = DirectFrame(frameColor=(1,1,1,1),frameSize=(_x-.1,_x+.1,_y+.1,_y-.1),parent=openI)
                OnscreenImage(image="data/models/cog_attacks/mini/{0}_{1}.png".format(track,attack),pos=Vec3(_x,0,_y),parent=f,scale=.1)
                
                f.bind(DGG.ENTER,lambda:_setT(track,attack))

_setT is not being called on mouse over event.

nevermind, changed to DGG.WITHIN and passed state=DGG.NORMAL to the constructor