本文整理汇总了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)
示例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)
示例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
示例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)
示例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)
示例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)
示例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
示例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
示例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)
示例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
示例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)