Skip to content Skip to sidebar Skip to footer

Moving A Image With Mouse Cursor In Kivy

I need to move a image with the mouse cursor in kivy it dosent mean that i want to change the mouse pointer to some image because i would then need to change the angle or that imag

Solution 1:

You can use the mouse_pos variable in the Window class. For example:

import kivy
kivy.require('1.0.8')

from kivy.core.window import Window
from kivy.app import App
from kivy.clock import Clock
from functools import partial


class MyMouse(App):

    def __init__(self, **kwargs):
        super(MyMouse, self).__init__(**kwargs)
        Clock.schedule_interval(partial(self.my_callback), 0.05)

    def my_callback(self, dt):
        print Window.mouse_pos

if __name__ == '__main__':
    MyMouse().run()

Post a Comment for "Moving A Image With Mouse Cursor In Kivy"