title: Kivy Drag Behavior Labels and Rectangles
body: <p>I am having trouble with one particular idea:</p>
  
  <p>I have created a rectangle that I am able to drag using the Drag Behavior in Kivy. Although, I want the rectangle to be dragged only left/right and fix the Y position. </p>
  
  <p>How can I accomplish this? I have tried multiple combinations, looked for this particular issue online, and I even checked the source code but I could not put it together. Any help is very much appreciated thank you!</p>
  
  <p><strong>Here is the code below:</strong></p>
  
  <pre><code>from kivy.uix.label import Label
  from kivy.app import App
  from kivy.uix.behaviors import DragBehavior
  from kivy.lang import Builder
  
  kv = '''
  &lt;DragLabel&gt;:
      # Define the properties for the DragLabel
      drag_rectangle: self.x, self.y, self.width, self.height
      drag_timeout: 10000000
      drag_distance: 0
  
  FloatLayout:
      # Define the root widget
      DragLabel:
          size_hint: 1.0, 0.2
          text: 'Drag me'
          canvas.before:
              Color:
                  rgb: .6, .6, .6
              Rectangle:
                  pos: self.pos
                  size: self.size 
  '''
  
  class DragLabel(DragBehavior, Label):
      pass
  
  class RectangleApp(App):
      def build(self):
          object = Builder.load_string(kv)
          return object
  
  if __name__ == '__main__':
      RectangleApp().run()
  </code></pre>