本文整理汇总了Python中kivy.uix.label.Label方法的典型用法代码示例。如果您正苦于以下问题:Python label.Label方法的具体用法?Python label.Label怎么用?Python label.Label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.label
的用法示例。
在下文中一共展示了label.Label方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def open(self):
self.app = App.get_running_app()
self.ids.placeholder.add_widget(Label(text='Loading....'))
self.manager.current = 'config_editor'
self.config = ConfigParser.get_configparser('Smoothie Config')
if self.config is None:
self.config = ConfigParser(name='Smoothie Config')
else:
for section in self.config.sections():
self.config.remove_section(section)
# get config, parse and populate
self.app.comms.redirect_incoming(self._add_line)
# issue command
self.app.comms.write('cat /sd/config.ini\n')
self.app.comms.write('\n') # get an ok to indicate end of cat
示例2: game
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def game(self,instance):
letters=self.letttersinput.text
letters = ",".join(list(letters))
#post data
mydata=[('letters', letters),('order','length'),('pos','beg'),('dic','1'),('table','dict')]
#Encoding
mydata=urllib.urlencode(mydata)
codedPath ='''aHR0cDovL3d3dy50aGV3b3JkZmluZGVyLmNvbS9zY3JhYmJsZS5waHA='''
path=base64.b64decode(codedPath)
req=urllib2.Request(path, mydata)
req.add_header("Content-type", "application/x-www-form-urlencoded")
page=urllib2.urlopen(req).read()
# applying beautifulsoup for parsing
soup = BS(page,"html.parser")
# parsing the div with id
res = soup.find("div", { "id" : "displayresults" })
Con= res.contents[1].contents[1]
line=""
for child in Con.children:
line+= child.string
popup = Popup(title="Result",content=Label(text=line))
popup.open()
示例3: get_buses
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def get_buses(self, *args):
"""Starts the process of retrieving countdown information."""
try:
# Load the bus data.
self.buses = HB.BusLookup(self.stop["stopid"])
except:
# If there's an error (e.g. no internet connection) then we have
# no bus data.
self.buses = None
if self.buses:
# We've got bus data so let's update the screen.
self.draw_filter()
else:
# No bus data so notify the user.
lb = Label(text="Error fetching data...")
self.ids.bx_filter.clear_widgets()
self.ids.bx_filter.add_widget(lb)
示例4: buildLabel
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def buildLabel(self):
mess = "One or more screens have not been initialised.\n\n"
# Loop over screens with unmet dependencies
if self.dep:
mess += "The following screens have unmet dependencies:\n\n"
for dep in self.dep:
mess += "{0}: {1}\n".format(dep[0], ",".join(dep[1]))
if self.failed:
mess += "\n\n"
# Loop over screens with other unhandled erros.
if self.failed:
mess += ("Errors were encountered trying to create the following "
"screens:\n\n")
for f in self.failed:
mess += "{0}: {1}\n".format(*f)
# Create a label.
lbl = Label(text=mess)
# Display it.
self.add_widget(lbl)
示例5: start
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def start(win, ctx):
# late import to avoid breaking module loading
from kivy.input.postproc import kivy_postproc_modules
kivy_postproc_modules['fps'] = StatsInput()
global _ctx
ctx.label = Label(text='FPS: 0.0')
ctx.inputstats = 0
ctx.stats = []
ctx.statsr = []
with win.canvas.after:
ctx.color = Color(1, 0, 0, .5)
ctx.rectangle = Rectangle(pos=(0, win.height - 25),
size=(win.width, 25))
ctx.color = Color(1, 1, 1)
ctx.rectangle = Rectangle(pos=(5, win.height - 20))
ctx.color = Color(1, 1, 1, .5)
for x in range(64):
ctx.stats.append(0)
ctx.statsr.append(
Rectangle(pos=(win.width - 64 * 4 + x * 4, win.height - 25),
size=(4, 0)))
Clock.schedule_interval(partial(update_fps, ctx), .5)
Clock.schedule_interval(partial(update_stats, ctx), 1 / 60.)
示例6: build
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def build(self):
btn1 = Button(text="Start Tests")
btn1.bind(on_press=self.start_tests)
btn2 = Button(text="Show Results")
btn2.bind(on_press=self.btn_pressed)
buttons = BoxLayout(orientation='horizontal')
buttons.add_widget(btn1)
buttons.add_widget(btn2)
label = Label(text="Test Results")
labels = BoxLayout(orientation='horizontal')
labels.add_widget(label)
layout = BoxLayout(orientation="vertical")
layout.add_widget(buttons)
layout.add_widget(labels)
return layout
示例7: initTracksList
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def initTracksList(self, track_ids=None):
self.setViewDisabled(True)
if track_ids is None:
track_ids = self.trackManager.track_ids
track_count = len(track_ids)
grid = self.ids.tracksgrid
grid.clear_widgets()
self.tracksGrid = grid
self.ids.tracksgrid.height = ((track_count) * (self.trackHeight + self.TRACK_HEIGHT_PADDING))
self.ids.scrltracks.height = 0
self.ids.scrltracks.scroll_y = 1.0
self.last_scroll_y = 1.0
self.loading = False
self.dismissPopups()
if track_count == 0:
Logger.info("TracksViews: no tracks")
self.tracksGrid.add_widget(Label(text="No tracks found - try checking for updates"))
self.setViewDisabled(False)
self.ids.namefilter.focus = True
else:
self.load_limit = self.INITIAL_DISPLAY_LIMIT if len(track_ids) > self.INITIAL_DISPLAY_LIMIT else len(track_ids)
self.current_track_ids = track_ids
self.addNextTrack(0, track_ids)
self.tracks_loading = True
示例8: on_enter
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def on_enter(self, *args):
# Find sessions, append to session list
sessions = self.datastore.get_sessions()
if len(sessions) == 0:
self.ids.session_list.add_widget(Label(text="No saved sessions"))
for session in sessions:
session_view = SessionListItem(session)
session_view.ids.name.text = session.name
session_view.ids.date.text = friendly_format_time_ago(datetime.utcfromtimestamp(session.date))
session_view.bind(on_delete=self.delete_session)
session_view.bind(on_add=self.add_session)
session_view.bind(on_export=self.export_session)
self.ids.session_list.add_widget(session_view)
示例9: _heading
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def _heading(game, view):
heading = Label(font_name='DroidSans-Regular.ttf', font_size=18,
color=HEADING_COLOR, markup=False)
heading.pos = (ANIM_TOGGLE_SIZE, 500 - PADDING)
heading.size = (960 - ANIM_TOGGLE_SIZE * 2, HEIGHT)
view.add_widget(heading)
def state_change(btn, state):
game.set_animooted(state == 'down')
anim_toggle = ToggleButton(background_normal='media/chkbox.png',
background_down='media/chkbox_a.png',
border=(0, 0, 0, 20), font_size=15,
text='Display Animations', state='down',
color=HEADING_COLOR, markup=False)
anim_toggle.pos = (965 - ANIM_TOGGLE_SIZE, 510 - PADDING)
anim_toggle.size = (ANIM_TOGGLE_SIZE, 30)
anim_toggle.bind(state=state_change)
view.add_widget(anim_toggle)
game._heading = heading
game.update_heading()
示例10: _notes
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def _notes(game, view):
label = Label(text='Root Note', font_size=15, color=LABEL_COLOR,
markup=False)
widgets = []
def state_change(btn, state):
if state == 'down':
game.set_root_note(btn.rel)
for i, note in enumerate(NOTES):
kwargs = {
'text': note.replace('#', u'\u266f'),
'group': 'notes',
'rel': note,
}
if not i:
kwargs['state'] = 'down'
btn = Radio(**kwargs)
btn.bind(state=state_change)
widgets.append(btn)
_add_widgets(view, label, widgets, 2, 50)
示例11: _scales
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def _scales(game, view):
label = Label(text='Scale', font_size=15, color=LABEL_COLOR,
markup=False)
widgets = []
def state_change(btn, state):
if state == 'down':
game.set_scale_class(btn.rel)
for i, seq in enumerate(SCALES):
kwargs = {
'text': seq.name,
'group': 'seq',
'rel': seq,
}
if not i:
kwargs['state'] = 'down'
btn = Radio(**kwargs)
btn.bind(state=state_change)
widgets.append(btn)
_add_widgets(view, label, widgets, 1, 140)
示例12: _tuning
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def _tuning(game, view):
label = Label(text='Tuning', font_size=15, color=LABEL_COLOR,
markup=False)
widgets = []
def state_change(btn, state):
if state == 'down':
game.set_tuning(btn.rel)
for i, tun in enumerate(TUNING):
kwargs = {
'text': tun['name'],
'group': 'tun',
'rel': tun,
}
if not i:
kwargs['state'] = 'down'
btn = Radio(**kwargs)
btn.bind(state=state_change)
widgets.append(btn)
_add_widgets(view, label, widgets, 0, 110)
示例13: __init__
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def __init__( self, **kargs ) :
super( Screen2, self ).__init__( **kargs )
"""
ScrollView with a refresh controll...
"""
self.myscroll = RefreshableScrollView(
on_start_reload=self.on_start_reload,
root_layout=self.shared_navigation_controller.floating_panel
)
self.add_widget( self.myscroll )
"""
Loading fake elements...
"""
temp = GridLayout( size_hint=(1,None), cols=1 )
for n in ['Pull down to reload','A fake error will be raised']+list(range(0,20)) :
l = Label( text='Element no '+str(n), height=dp(50), size_hint=(1,None), color=[0,0,0,.8] )
temp.add_widget( l )
temp.height += dp(50)
self.myscroll.add_widget( temp )
示例14: __init__
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def __init__( self, **kargs ) :
super( AskTextPopup, self ).__init__( **kargs )
self.input_field = flatui.FlatTextInput(
focus = True,
hint = self.text_hint,
font_name = self.content_font_name,
font_size = self.content_font_size,
size_hint = [ .8, 1 ]
)
b = BoxLayout()
b.add_widget( Label( size_hint=[.1,1] ) )
b.add_widget( self.input_field )
b.add_widget( Label( size_hint=[.1,1] ) )
self.content.add_widget( b, 1 )
if not self.multiline :
pass
示例15: _redraw_y
# 需要导入模块: from kivy.uix import label [as 别名]
# 或者: from kivy.uix.label import Label [as 别名]
def _redraw_y(self, *args):
font_size = self.font_size
if self.ylabel:
ylabel = self._ylabel
if not ylabel:
ylabel = GraphRotatedLabel(angle=90)
self.add_widget(ylabel)
self._ylabel = ylabel
ylabel.font_size = font_size
for k, v in self.label_options.items():
setattr(ylabel, k, v)
else:
ylabel = self._ylabel
if ylabel:
self.remove_widget(ylabel)
self._ylabel = None
grids = self._y_grid_label
ypoints_major, ypoints_minor = self._get_ticks(self.y_ticks_major,
self.y_ticks_minor,
self.ylog, self.ymin,
self.ymax)
self._ticks_majory = ypoints_major
self._ticks_minory = ypoints_minor
if not self.y_grid_label:
n_labels = 0
else:
n_labels = len(ypoints_major)
for k in range(n_labels, len(grids)):
self.remove_widget(grids[k])
del grids[n_labels:]
grid_len = len(grids)
grids.extend([None] * (n_labels - len(grids)))
for k in range(grid_len, n_labels):
grids[k] = Label(font_size=font_size, **self.label_options)
self.add_widget(grids[k])
return ypoints_major, ypoints_minor