SHARE
TWEET

Untitled

a guest Jun 15th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Myszka(Widget):
  2.  
  3.     def on_touch_down(self, touch):
  4.         ...
  5.         App.get_running_app().root.add_widget(self.flaga)
  6.      
  7. import os
  8. from kivy.app import App
  9. from kivy.uix.floatlayout import FloatLayout
  10. from kivy.uix.image import Image
  11.  
  12.  
  13. class Mouse(FloatLayout):
  14.  
  15.     def on_touch_down(self, touch):
  16.         img_path = "/home/iam/Pictures/AppImages"
  17.         flag_path = os.path.join(img_path, "Android_celebrate.png")
  18.         flag = Image(source=flag_path, size_hint=(None, None), size=(64, 64),
  19.                      pos=(round(touch.pos[0], 1), round(touch.pos[1], 1)))
  20.         self.add_widget(flag)
  21.  
  22.  
  23. class TestApp(App):
  24.  
  25.     def build(self):
  26.         return Mouse()
  27.  
  28.  
  29. if __name__ == "__main__":
  30.     TestApp().run()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top