本文整理汇总了Python中kivy.uix.boxlayout.BoxLayout方法的典型用法代码示例。如果您正苦于以下问题:Python boxlayout.BoxLayout方法的具体用法?Python boxlayout.BoxLayout怎么用?Python boxlayout.BoxLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.boxlayout
的用法示例。
在下文中一共展示了boxlayout.BoxLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def __init__(self, *args, **kwargs):
super(AddBlockButton, self).__init__(*args, **kwargs)
self.bind(on_release=self.openPopup)
box=BoxLayout(padding=10)
self.Input=TextInput(text="New Block", multiline=False, font_size=18)
self.Input.bind(on_text_validate=self.addBlock)
b=Button(text="Add it")
b.bind(on_release=self.addBlock)
box.add_widget(self.Input)
box.add_widget(b)
self.addPopup = Popup(title="Add A New Block",
size_hint=(None,None),
size=(400,115),
separator_color=[.9,.4,.2,1],
background_color=[0,0,0,.6],
content=box
)
示例2: build
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def build(self):
Builder.load_string('''
<TextInput>
on_text:
self.suggestion_text = ''
self.suggestion_text = 'ion_text'
''')
root = BoxLayout(orientation='vertical')
textinput = TextInput(multiline=True, use_bubble=True,
use_handles=True)
#textinput.text = __doc__
root.add_widget(textinput)
textinput2 = TextInput(multiline=False, text='monoline textinput',
size_hint=(1, None), height=30)
root.add_widget(textinput2)
return root
示例3: build
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [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
示例4: _draw_buttons
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def _draw_buttons(self):
"""
Encompasses the drawing of buttons onto the card.
"""
button_layout = BoxLayout(orientation="horizontal", size_hint=(1, 0.2))
for button in self.buttons:
b = Button(text=button["label"])
b.bind(on_press=self._button_click(button["target"]))
if "text_size" in button:
b.font_size = button["text_size"]
else:
b.font_size = 24
if "text_color" in button:
b.color = palette(button["text_color"])
else:
b.color = palette("white")
if "background_color" in button:
b.background_color = palette(button["background_color"])
else:
b.background_color = palette("grey")
self.button_widgets.append(b)
button_layout.add_widget(b)
self.layout.add_widget(button_layout)
示例5: _update_can_settings
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def _update_can_settings(self, cfg):
self.can_config = cfg.canConfig
capabilities = cfg.capabilities
can_settings = self.ids.can_settings
can_settings.clear_widgets()
can_channel_count = capabilities.channels.can
for i in range(0, can_channel_count):
can_settings.add_widget(FieldLabel(text=str(i + 1), halign='center'))
baud_rate = CANBaudRateSpinner()
baud_rate.channel_id = i
baud_rate.bind(text=self.on_can_baud)
baud_rate.setFromValue(self.can_config.baudRate[i])
can_settings.add_widget(baud_rate)
if capabilities.has_can_term:
termination = CANTerminationSwitch()
termination.channel_id = i
termination.active = self.can_config.termination_enabled[i]
termination.bind(active=self.on_can_termination)
can_settings.add_widget(termination)
else:
can_settings.add_widget(BoxLayout())
示例6: __init__
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [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
示例7: build
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def build(self):
fl = BoxLayout(orientation="vertical")
a = Button(text="press me", height=40, size_hint_y=None)
a.bind(on_press=callback)
nav1 = NavigationToolbar2Kivy(canvas)
nav2 = NavigationToolbar2Kivy(canvas2)
fl.add_widget(nav1.actionbar)
fl.add_widget(canvas)
fl.add_widget(nav2.actionbar)
fl.add_widget(canvas2)
fl.add_widget(a)
return fl
示例8: __init__
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def __init__(self, canvas, **kwargs):
self.actionbar = ActionBar(pos_hint={'top': 1.0})
super(NavigationToolbar2Kivy, self).__init__(canvas)
self.rubberband_color = (1.0, 0.0, 0.0, 1.0)
self.lastrect = None
self.save_dialog = Builder.load_string(textwrap.dedent('''\
<SaveDialog>:
text_input: text_input
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserListView:
id: filechooser
on_selection: text_input.text = self.selection and\
self.selection[0] or ''
TextInput:
id: text_input
size_hint_y: None
height: 30
multiline: False
BoxLayout:
size_hint_y: None
height: 30
Button:
text: "Cancel"
on_release: root.cancel()
Button:
text: "Save"
on_release: root.save(filechooser.path,\
text_input.text)
'''))
示例9: checkscreen
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def checkscreen(self):
"""Updates the screen depending on the state of the league object."""
# If there are league matches, clear the screen
if self.leagueobject:
self.leaguename = self.leagueobject.LeagueName
if self.newbox:
self.newbox.clear_widgets()
else:
self.newbox = BoxLayout(orientation="vertical",
size_hint_y=0.8)
self.leaguebox.add_widget(self.newbox)
# Get the stack of league matches
self.leaguestack = self.createStack()
# And work out how to place it in the middle of the screen.
if self.spacer:
sph = ((self.parent.height * .8) - self.h) / 2.0
self.newbox.add_widget(Widget(size_hint=(1, None), height=sph))
self.newbox.add_widget(self.leaguestack)
if self.spacer:
self.newbox.add_widget(Widget(size_hint=(1, None), height=sph))
# No league matches
else:
if self.newbox:
self.leaguebox.remove_widget(self.newbox)
self.leaguename = "No league matches found."
示例10: build_tides_list
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [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)
示例11: __init__
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def __init__(self, **kwargs):
# print kwargs
super(ErrorPopup, self).__init__()
# super(ErrorPopup, self).__init__(**kwargs)
content = BoxLayout(orientation="vertical")
content.add_widget(Label(text=kwargs['text'], font_size=20))
mybutton = Button(text="Dismiss", size_hint=(1,.20), font_size=20)
content.add_widget(mybutton)
self.content = content
self.title = kwargs["title"]
self.auto_dismiss = False
self.size_hint = .7, .5
self.font_size = 20
mybutton.bind(on_release=self.exit_popup)
self.open()
示例12: _create_popup
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def _create_popup(self, *_):
app = App.get_running_app()
if app.database_scanning:
return
content = BoxLayout(orientation='vertical')
popup_width = min(0.95 * Window.width, dp(500))
self.popup = popup = NormalPopup(title=self.title, content=content, size_hint=(None, 0.9), width=popup_width)
if not self.value:
content.add_widget(ShortLabel(height=app.button_scale * 3, text="You must set at least one database directory.\n\nThis is a folder where your photos are stored.\nNew photos will be imported to a database folder."))
content.add_widget(BoxLayout())
else:
folders = filter(None, self.value.split(';'))
folderdata = []
for folder in folders:
folderdata.append({'text': folder})
self.folderlist = folderlist = FolderSettingsList(size_hint=(1, .8), id='folderlist')
folderlist.data = folderdata
content.add_widget(folderlist)
buttons = BoxLayout(orientation='horizontal', size_hint=(1, None), height=app.button_scale)
addbutton = NormalButton(text='+')
addbutton.bind(on_release=self.add_path)
removebutton = NormalButton(text='-')
removebutton.bind(on_release=self.remove_path)
okbutton = WideButton(text='OK')
okbutton.bind(on_release=self._dismiss)
buttons.add_widget(addbutton)
buttons.add_widget(removebutton)
buttons.add_widget(okbutton)
content.add_widget(buttons)
popup.open()
示例13: __init__
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def __init__(self, **kwargs):
self._prev_arrow_pos = None
self._arrow_layout = BoxLayout()
self._bk_img = Image(
source=self.background_image, allow_stretch=True,
keep_ratio=False, color=self.background_color)
self.background_texture = self._bk_img.texture
self._arrow_img = Image(source=self.arrow_image,
allow_stretch=True,
color=self.background_color)
self.content = content = BubbleContent(parent=self)
super(Bubble, self).__init__(**kwargs)
content.parent = None
self.add_widget(content)
self.on_arrow_pos()
示例14: _create_popup
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [as 别名]
def _create_popup(self, instance):
# create popup layout
content = BoxLayout(orientation='vertical', spacing='5dp')
popup_width = min(0.95 * Window.width, dp(500))
self.popup = popup = Popup(
title=self.title, content=content, size_hint=(None, None),
size=(popup_width, '250dp'))
# create the textinput used for numeric input
self.textinput = textinput = TextInput(
text=self.value, font_size='24sp', multiline=False,
size_hint_y=None, height='42sp')
textinput.bind(on_text_validate=self._validate)
self.textinput = textinput
# construct the content, widget are used as a spacer
content.add_widget(Widget())
content.add_widget(textinput)
content.add_widget(Widget())
content.add_widget(SettingSpacer())
# 2 buttons are created for accept or cancel the current value
btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
btn = Button(text='Ok')
btn.bind(on_release=self._validate)
btnlayout.add_widget(btn)
btn = Button(text='Cancel')
btn.bind(on_release=self._dismiss)
btnlayout.add_widget(btn)
content.add_widget(btnlayout)
# all done, open the popup !
popup.open()
示例15: build
# 需要导入模块: from kivy.uix import boxlayout [as 别名]
# 或者: from kivy.uix.boxlayout import BoxLayout [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