Python kivy.uix.scrollview.ScrollView() Examples

The following are 12 code examples of kivy.uix.scrollview.ScrollView(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module kivy.uix.scrollview , or try the search function .
Example #1
Source File: ui.py    From kivy-2014 with MIT License 7 votes vote down vote up
def init_ui(game):
    view = Widget()

    _heading(game, view)
    _notes(game, view)
    _scales(game, view)
    _tuning(game, view)

    view.add_widget(game)

    if platform in ('android', 'ios'):
        from kivy.core.window import Window
        from kivy.uix.scrollview import ScrollView

        app_view = view
        app_view.size = (960, 540)
        app_view.size_hint = (None, None)

        view = ScrollView(size=Window.size)
        view.effect_cls = ScrollEffect
        view.add_widget(app_view)

    return view 
Example #2
Source File: screen.py    From RPi-InfoScreen-Kivy with GNU General Public License v3.0 6 votes vote down vote up
def draw_buses(self):
        """Adds the buses to the main screen."""
        # Clear the screen of any buses.
        self.ids.bx_buses.clear_widgets()

        # Get a list of just those buses who are included in the filter.
        buses = [b for b in self.buses if b["route"] in self.filters]

        # Work out the height needed to display all the buses
        # (we need this for the StackLayout)
        h = (len(buses) * 30)

        # Create a StackLayout and ScrollView
        sl = StackLayout(orientation="tb-lr", height=h, size_hint=(1, None))
        sv = ScrollView(size_hint=(1, 1))
        sv.add_widget(sl)
        self.ids.bx_buses.add_widget(sv)

        # Loop over the buses, create a FinlandArrivals object and add it to the
        # StackLayout
        for bus in buses:
            bs = FinlandArrivals(bus=bus)
            if "alert" in(bus):
                self.alert = bus["alert"]
            sl.add_widget(bs) 
Example #3
Source File: screen.py    From RPi-InfoScreen-Kivy with GNU General Public License v3.0 6 votes vote down vote up
def draw_buses(self):
        """Adds the buses to the main screen."""
        # Clear the screen of any buses.
        self.ids.bx_buses.clear_widgets()

        # Get a list of just those buses who are included in the filter.
        buses = [b for b in self.buses if b["route"] in self.filters]

        # Work out the height needed to display all the buses
        # (we need this for the StackLayout)
        h = (len(buses) * 30)

        # Create a StackLayout and ScrollView
        sl = StackLayout(orientation="tb-lr", height=h, size_hint=(1, None))
        sv = ScrollView(size_hint=(1, 1))
        sv.add_widget(sl)
        self.ids.bx_buses.add_widget(sv)

        # Loop over the buses, create a LondonBus object and add it to the
        # StackLayout
        for bus in buses:
            bs = LondonBus(bus=bus)
            sl.add_widget(bs) 
Example #4
Source File: bottomsheet.py    From KivyMD with MIT License 5 votes vote down vote up
def add_widget(self, widget, index=0):
		if type(widget) == ScrollView:
			super(MDBottomSheet, self).add_widget(widget, index)
		else:
			self.gl_content.add_widget(widget, index) 
Example #5
Source File: screen.py    From RPi-InfoScreen-Kivy with GNU General Public License v3.0 5 votes vote down vote up
def build_tides_list(self):
        if self.tides == None:
            return
        self.tides_list.clear_widgets()

        w = (len(self.tides['extremes']) - 1) * 150
        tl = BoxLayout(orientation="horizontal", size=(w, 60),
                    size_hint=(None, 1), spacing=5)
        sv = ScrollView(size_hint=(1, 1.1), bar_margin = -5, do_scroll_y = False)
        sv.add_widget(tl)
        for tide in self.tides['extremes']:
            if self.next_t["dt"] < tide["dt"]:
                uptide = Tide(summary = tide, language = self.language)
                tl.add_widget(uptide)
        self.tides_list.add_widget(sv) 
Example #6
Source File: settings.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def add_panel(self, panel, name, uid):
        scrollview = ScrollView()
        scrollview.add_widget(panel)
        if not self.tabbedpanel.default_tab_content:
            self.tabbedpanel.default_tab_text = name
            self.tabbedpanel.default_tab_content = scrollview
        else:
            panelitem = TabbedPanelHeader(text=name, content=scrollview)
            self.tabbedpanel.add_widget(panelitem) 
Example #7
Source File: settings.py    From Tickeys-linux with MIT License 5 votes vote down vote up
def add_panel(self, panel, name, uid):
        scrollview = ScrollView()
        scrollview.add_widget(panel)
        if not self.tabbedpanel.default_tab_content:
            self.tabbedpanel.default_tab_text = name
            self.tabbedpanel.default_tab_content = scrollview
        else:
            panelitem = TabbedPanelHeader(text=name, content=scrollview)
            self.tabbedpanel.add_widget(panelitem) 
Example #8
Source File: form_parser.py    From deepdiy with MIT License 5 votes vote down vote up
def build(self):
		root=BoxLayout()
		window=ScrollView(scroll_type=["bars"],  bar_width=20)
		root.add_widget(window)

		form_parser=FormParser()
		window.add_widget(form_parser)
		form_parser.load_json('../model_zoo/mrcnn/config_form.json')

		from kivy.uix.button import Button
		root.add_widget(Button(text='reset',size_hint_x=None,width='100dp',on_release=form_parser.reset))
		root.add_widget(Button(text='export',size_hint_x=None,width='100dp',on_release=form_parser.export))

		return root 
Example #9
Source File: resource_tree.py    From deepdiy with MIT License 5 votes vote down vote up
def build(self):
        from kivy.uix.boxlayout import BoxLayout
        from kivy.uix.button import Button
        root=BoxLayout()
        window=ScrollView(scroll_type=["bars"],  bar_width=20)
        root.add_widget(window)
        window.add_widget(self.resource_tree)
        return root 
Example #10
Source File: bottomsheet.py    From Blogs-Posts-Tutorials with MIT License 5 votes vote down vote up
def add_widget(self, widget, index=0):
        if type(widget) == ScrollView:
            super(MDBottomSheet, self).add_widget(widget, index)
        else:
            self.gl_content.add_widget(widget,index) 
Example #11
Source File: screen.py    From RPi-InfoScreen-Kivy with GNU General Public License v3.0 4 votes vote down vote up
def createStack(self):
        """Works out how to display the league matches.

        Layout depends on the number of matches found.
        """
        matches = self.leagueobject.LeagueMatches
        x = len(matches)

        # Single column, no scrolling
        if x <= 10:
            self.spacer = True
            w = 1
            scroll = False
            self.h = 42 * x

        # Dual columns, no scrolling
        elif x <= 20:
            self.spacer = False
            w = 0.5
            scroll = False
            self.h = round(x/2.0) * 42

        # Dual columns, scrolling
        else:
            self.spacer = False
            w = 0.5
            scroll = True
            self.h = round(x/2.0) * 42

        # Create a stack layout
        stack = StackLayout(orientation="tb-lr",
                            size_hint_y=None,
                            height=self.h)

        stack.bind(minimum_height=stack.setter('height'))

        # Add the league matches to it.
        for l in matches:
            lg = LeagueGame(match=l, size_hint=(w, None))
            stack.add_widget(lg)

        # Create a scroll view
        scroll = ScrollView(size_hint=(1, 1))
        scroll.add_widget(stack)

        return scroll 
Example #12
Source File: screen.py    From RPi-InfoScreen-Kivy with GNU General Public License v3.0 4 votes vote down vote up
def getData(self, *args):
        # Try to get the daily data but handle any failure to do so.
        try:
            self.forecast = requests.get(self.url_forecast).json()
            days = self.forecast["forecast"]["simpleforecast"]["forecastday"]
        except:
            days = None

        # Try to get the hourly data but handle any failure to do so.
        try:
            self.hourly = requests.get(self.url_hourly).json()
            hours = self.hourly["hourly_forecast"]
        except:
            hours = None

        # Clear the screen of existing widgets
        self.bx_forecast.clear_widgets()
        self.bx_hourly.clear_widgets()

        # If we've got daily info then we can display it.
        if days:
            for day in days:
                frc = WeatherForecastDay(summary=day)
                self.bx_forecast.add_widget(frc)

        # If not, let the user know.
        else:
            lb_error = Label(text="Error getting weather data.")
            self.bx_forecast.add_widget(lb_error)

        # If we've got hourly weather data then show it
        if hours:

            # We need a scroll view as there's a lot of data...
            w = len(hours) * 45
            bx = BoxLayout(orientation="horizontal", size=(w, 180),
                           size_hint=(None, None), spacing=5)
            sv = ScrollView(size_hint=(1, 1))
            sv.add_widget(bx)

            for hour in hours:
                frc = WeatherForecastHourly(summary=hour)
                bx.add_widget(frc)
            self.bx_hourly.add_widget(sv)

        # If there's no data, let the user know
        else:
            lb_error = Label(text="Error getting weather data.")
            self.bx_forecast.add_widget(lb_error)

        # We're done, so schedule the next update
        if hours and days:
            dt = 60 * 60
        else:
            dt = 5 * 60

        self.nextupdate = time.time() + dt
        self.timer = Clock.schedule_once(self.getData, dt)