'Kivy: Prevent Slider from Registering as Screen Swipes

Struggling through learning Kivy, trying to do some home automation with a Rasberry PI.

I have a UI laid out, where one of the elements is a process slider that goes across the whole screen in a box layout. There are additional elements above and below.

I want to be able to "swipe" on the screen to switch between screens, which I think I have figured out. However, I've noticed if I move the process slider, it also register as a "swipe" because it's moving across the screen by the same amount. My understanding was that I needed to capture when the touch point collided with the slider widget and do something to prevent the screen transition, however everything I try either blocks use of the slider, or still causes the issue to happen. What am I missing? My .py below:

activate_this_file = "/home/pi/kivy_venv/bin/activate_this.py"
exec(open(activate_this_file).read(), {'__file__': activate_this_file})

import kivy
import random
import time
kivy.require('1.0.6') # replace with your current kivy version !

from kivy.app import App

from kivy.config import Config


from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.uix.widget import Widget
from kivy.properties import StringProperty
from kivy.properties import ObjectProperty
from kivy.properties import NumericProperty
from kivy.properties import ListProperty
from kivy.uix.slider import Slider
from kivy.uix.screenmanager import ScreenManager, Screen, SlideTransition
from kivy.core.window import Window
from kivy.clock import Clock
from kivy.lang import Builder



class StatusBarWidget(BoxLayout):
    bl_statbar = ObjectProperty(None)
    pass

class StartStopWidget(BoxLayout):
    stuff_b = ObjectProperty(None)
    
class ProcessValWidget(BoxLayout):
    stuff_c = ObjectProperty(None)
    
class ImageWidget(BoxLayout):
    lbl_img = ObjectProperty(None)
    pass
    
class SetPointWidget(BoxLayout):
    lbl_setpoint = ObjectProperty(None)
    pass
    
class ProcessSliderWidget(BoxLayout):
        
    def on_touch_down(self, touch):
        if self.collide_point(*touch.pos):
            print ("Collide")
            return super(BoxLayout, self).on_touch_down(touch)
            Program1App.scrn_touch_disable = False

class FirstScreen(Screen):  
    pass
    
class SecondScreen(Screen):
    pass
    
class ThirdScreen(Screen):
    pass
    
class FourthScreen(Screen):
    pass
    
    
class MyScreenManager(ScreenManager):
    def __init__(self, **kwargs):
        super(MyScreenManager,self).__init__(**kwargs)
        #Clock.schedule_once(self.screen_switch_one, 2)
        self.current = '_first_screen_'
        
    def on_touch_down(self, touch):
        super(ScreenManager, self).on_touch_down(touch)
        Program1App.scrn_touch_disable = True       
                
    def on_touch_up(self, touch):
        if touch.ox - touch.x > 175 and Program1App.scrn_touch_disable == True:
            Program1App.index2 = Program1App.get_running_app().go_previous_screen()
            Program1App.scrn_touch_disable = False
            
        if touch.x - touch.ox > 175 and Program1App.scrn_touch_disable == True:
            Program1App.index2 = Program1App.get_running_app().go_next_screen()
            Program1App.scrn_touch_disable = False
        
class Program1App(App):
    
    time = NumericProperty(0)
    #screen_names = ListProperty([])
    index2 = 1
    #scrn_touch_disable = True
    
    def build(self):
        self.screens = ['_first_screen_', '_second_screen_', '_third_screen_', '_fourth_screen_']
        
        Window.bind(on_key_down=self.key_action)    
        return MyScreenManager()
                            
    def change_label_g(self):
        app = App.get_running_app()
        #app.root.ids.statbar.lbl_statbar.text = "RUNNING"  
        #app = App.get_running_app().root.get_screen('_first_screen_')
        
        #app.root.current = '_second_screen_'
        screen_manager = App.get_running_app().root.current_screen
        screen_manager.ids.statbar.lbl_statbar.text = "RUNNING"
        
    def stop(self):
        Clock.unschedule(self.randvalue)
        #app = App.get_running_app()
        #app.root.ids.statbar.lbl_statbar.text = "STOPPED"  
        app = App.get_running_app().root.current_screen
        app.ids.statbar.lbl_statbar.text = "STOPPED"    
            
    def key_action(self, *args):
        #print ("got a key event %s" % list(args))
        if args[1] == 275:
            #Program1App.index2 = self.go_previous_screen(Program1App.index2)
            Program1App.index2 = self.go_previous_screen()
        if args[1] == 276:
            Program1App.index2 = self.go_next_screen()
            
        
    def go_previous_screen(self):
        index2 = Program1App.index2
        if index2 > 0:
            index2 = index2 - 1
        else:
            index2 = 3
        
        App.get_running_app().root.transition = SlideTransition(direction='left', duration=.25)     
        App.get_running_app().root.current = self.screens[index2]
                
        if index2 != 0:
            screen_manager = App.get_running_app().root.current_screen
            screen_manager.ids.img.lbl_img.source = self.pictures[index2]
            App.get_running_app().root.current_screen.ids.setpoint.lbl_setpoint.text = "Pressure: " 
        
        return index2
        
    def go_next_screen(self):
        index2 = Program1App.index2
        if index2 < 3:
            index2 = index2 + 1
        else:
            index2 = 0
            
        App.get_running_app().root.transition = SlideTransition(direction='right', duration=.25)    
        App.get_running_app().root.current = self.screens[index2]
        
        if index2 != 0:
            screen_manager = App.get_running_app().root.current_screen
        

        return index2
        
    
if __name__ == '__main__':
    Program1App().run()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source