I'm trying to create a rectangle in kivy that follows my mouse so that the top (short side) of the rectangle is always perpendicular to the line between the rectangle and my mouse.
I have not been able to try anything since I know not very much about Kivy.
Full Code:
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.graphics import Color, Rectangle
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.core.audio import SoundLoader
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.image import Image
from kivy.config import Config
from kivy.graphics import *
from kivy.utils import *
class Myapp(Widget):
Config.set('graphics', 'resizable', True)
def __init__(self, **kwargs):
super(Myapp, self).__init__(**kwargs)
sound = SoundLoader.load('theme.mp3')
sound.play()
class MenuScreen(Screen):
pass
class Game(Screen, Widget):
def __init__(self, **kwargs):
super(Game, self).__init__(**kwargs)
Config.set('graphics', 'resizable', True)
with self.canvas:
Color(0, 0, 0)
Rectangle(pos=(10, 10), size=(150, 50))
class Myapp(ScreenManager):
pass
class MyApp(App):
def build(self):
return Myapp()
if __name__ == '__main__':
MyApp().run()
Full description of what I am trying to do: After an initial starting screen, I click the start button to go to the main place. In this place, for now, I need to have a rectangle that follows the movement of my mouse.