當前位置: 首頁>>代碼示例>>Python>>正文


Python scrollview.ScrollView方法代碼示例

本文整理匯總了Python中kivy.uix.scrollview.ScrollView方法的典型用法代碼示例。如果您正苦於以下問題:Python scrollview.ScrollView方法的具體用法?Python scrollview.ScrollView怎麽用?Python scrollview.ScrollView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kivy.uix.scrollview的用法示例。


在下文中一共展示了scrollview.ScrollView方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: draw_buses

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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) 
開發者ID:elParaguayo,項目名稱:RPi-InfoScreen-Kivy,代碼行數:27,代碼來源:screen.py

示例2: draw_buses

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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) 
開發者ID:elParaguayo,項目名稱:RPi-InfoScreen-Kivy,代碼行數:25,代碼來源:screen.py

示例3: init_ui

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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 
開發者ID:mvasilkov,項目名稱:kivy-2014,代碼行數:25,代碼來源:ui.py

示例4: add_widget

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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) 
開發者ID:kivymd,項目名稱:KivyMD,代碼行數:7,代碼來源:bottomsheet.py

示例5: build_tides_list

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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) 
開發者ID:elParaguayo,項目名稱:RPi-InfoScreen-Kivy,代碼行數:17,代碼來源:screen.py

示例6: add_panel

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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) 
開發者ID:BillBillBillBill,項目名稱:Tickeys-linux,代碼行數:11,代碼來源:settings.py

示例7: build

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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 
開發者ID:deepdiy,項目名稱:deepdiy,代碼行數:16,代碼來源:form_parser.py

示例8: build

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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 
開發者ID:deepdiy,項目名稱:deepdiy,代碼行數:10,代碼來源:resource_tree.py

示例9: add_widget

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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) 
開發者ID:kiok46,項目名稱:Blogs-Posts-Tutorials,代碼行數:7,代碼來源:bottomsheet.py

示例10: createStack

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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 
開發者ID:elParaguayo,項目名稱:RPi-InfoScreen-Kivy,代碼行數:48,代碼來源:screen.py

示例11: getData

# 需要導入模塊: from kivy.uix import scrollview [as 別名]
# 或者: from kivy.uix.scrollview import ScrollView [as 別名]
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) 
開發者ID:elParaguayo,項目名稱:RPi-InfoScreen-Kivy,代碼行數:60,代碼來源:screen.py


注:本文中的kivy.uix.scrollview.ScrollView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。