title: Kivy - How to drag and drop items from ScrollView to another layout?
body: <p>I'm attempting to drag some images arranged inside a GridLayout (which is indeed inside a ScrollView) to outer Layout. </p>
  
  <p>The image to be dragged has its <code>on_touch_down</code> event defined, when image is clicked parent is changed from <code>WidgetMenu</code> to <code>MainLayout</code> so it can be dragged between those widgets. The current problem is when I touch the image, DragBehavior is lost.</p>
  
  <p>The full code:</p>
  
  <pre><code>import kivy
  kivy.require("1.9.1")
  from kivy.app import App
  from kivy.core.window import Window
  from kivy.uix.scrollview    import ScrollView
  from kivy.uix.widget import Widget
  from kivy.uix.behaviors import DragBehavior
  from kivy.uix.floatlayout import FloatLayout
  from kivy.uix.boxlayout import BoxLayout
  from kivy.uix.gridlayout import GridLayout
  
  from kivy.base import runTouchApp
  from kivy.lang import Builder
  
  Builder.load_string('''
  &lt;WidgetMenu&gt;:
      canvas.before:
          Color:
              rgb: 0.9,0.5,0.3
          RoundedRectangle:
              pos:self.pos
              size: self.size
              radius: [20,]
      orientation: "vertical"
      padding:30
  
      ScrollView:
  
          GridLayout:
              cols:1
              size_hint_y:None
              row_default_height:root.height*.15
              height:self.minimum_height
              DragImage:
              DragImage:
              DragImage:
  
  
  &lt;DragImage&gt;:
      drag_rectangle: self.x, self.y, self.width, self.height
      drag_timeout: 100000000
      drag_distance: 0
      size_hint:None,None
      size:234,34
      canvas:
          Color:
              rgb:1,0,1
          Rectangle:
              pos: self.pos
              size: self.size
  
  &lt;MainLayout&gt;:
      canvas:
          Color:
              rgb:1,1,1
          Rectangle:
              size: self.size
              pos: self.pos
      WidgetMenu:
          size_hint: 0.35,0.9
  
  ''')
  
  class MainLayout(FloatLayout):
      pass
  class WidgetMenu(BoxLayout):
      pass
  class DragImage(DragBehavior,FloatLayout):
      def on_touch_down(self,touch):
          workspace = self.parent.parent.parent.parent
          grid = self.parent
          menu = self.parent.parent.parent
          if "MainLayout" in str(workspace):
              grid.remove_widget(self)
              workspace.remove_widget(menu)
              self.pos = Window.mouse_pos
              workspace.add_widget(self)
          return True
  
  class ScrollApp(App):
      def build(self):
          return MainLayout()
  
  ScrollApp().run()
  </code></pre>
  
  <p>Please help.</p>