How to use the kivy.lang.Builder function in Kivy

To help you get started, we’ve selected a few Kivy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kivy / kivy-designer / designer / uix / completion_bubble.py View on Github external
def on_complete(self, *args):
        '''Dispatch a completion selection
        '''
        Window.unbind(on_key_down=self.on_key_down)

    def on_cancel(self, *args):
        '''Disable key listener on cancel
        '''
        Window.unbind(on_key_down=self.on_key_down)

if __name__ == '__main__':
    from kivy.app import App
    import jedi

    Builder.load_string('''
:
    background_normal: ''
    background_color: 1, 0, 1, 1
    canvas.before:
        Color:
            rgba: 1, 1, 1, 0.8
        Rectangle:
            pos: self.pos
            size: self.size
    Button:
        text: 'Toggle Completion Menu'
        size_hint: None, None
        width: 250
        height: 50
        pos_hint: {'center_x': 0.5, 'center_y': 0.5}
        on_press: root.show_bubble()
github qtumproject / qtum-electrum / electrum / gui / kivy / uix / dialogs / lightning_open_channel.py View on Github external
from kivy.lang import Builder
from kivy.factory import Factory

from electrum.gui.kivy.i18n import _
from electrum.lnaddr import lndecode
from electrum.bitcoin import COIN
import electrum.simple_config as config

from .label_dialog import LabelDialog

if TYPE_CHECKING:
    from ...main_window import ElectrumWindow


Builder.load_string('''

    id: s
    name: 'lightning_open_channel'
    title: _('Open Lightning Channel')
    pubkey: ''
    amount: ''
    ipport: ''
    BoxLayout
        spacing: '12dp'
        padding: '12dp'
        orientation: 'vertical'
        SendReceiveBlueBottom:
            id: blue_bottom
            size_hint: 1, None
            height: self.minimum_height
            BoxLayout:
github BillBillBillBill / Tickeys-linux / tickeys / kivy / uix / listview.py View on Github external
c.select_from_composite(*args)

    def deselect_from_child(self, child, *args):
        for c in self.children:
            if c is not child:
                c.deselect_from_composite(*args)

    def __repr__(self):
        if self.representing_cls is not None:
            return '<%r>, representing <%s>' % (
                self.representing_cls, self.__class__.__name__)
        else:
            return '<%s>' % (self.__class__.__name__)


Builder.load_string('''
:
    container: container
    ScrollView:
        pos: root.pos
        on_scroll_y: root._scroll(args[1])
        do_scroll_x: False
        GridLayout:
            cols: 1
            id: container
            size_hint_y: None
''')


class ListView(AbstractView, EventDispatcher):
    ''':class:`~kivy.uix.listview.ListView` is a primary high-level widget,
    handling the common task of presenting items in a scrolling list.
github qtumproject / qtum-electrum / electrum / gui / kivy / uix / screens.py View on Github external
# note: this list needs to be kept in sync with another in qt
TX_ICONS = [
    "unconfirmed",
    "close",
    "unconfirmed",
    "close",
    "clock1",
    "clock2",
    "clock3",
    "clock4",
    "clock5",
    "confirmed",
]


Builder.load_file('electrum/gui/kivy/uix/ui_screens/history.kv')
Builder.load_file('electrum/gui/kivy/uix/ui_screens/send.kv')
Builder.load_file('electrum/gui/kivy/uix/ui_screens/receive.kv')


class HistoryScreen(CScreen):

    tab = ObjectProperty(None)
    kvname = 'history'
    cards = {}

    def __init__(self, **kwargs):
        self.ra_dialog = None
        super(HistoryScreen, self).__init__(**kwargs)

    def show_item(self, obj):
        key = obj.key
github ellisonleao / pybrapp / pybr / uix / pydelhiconf.py View on Github external
'''uix.pydelhiconf module which should house all common widgets.
'''

from kivy.uix.screenmanager import ScreenManager
from kivy.lang import Builder

class PyDelhiConfScreenManager(ScreenManager):
	Builder.load_string('''
#:import WipeTransition kivy.uix.screenmanager.WipeTransition
github CP1404 / KivyDemos / button_event_demo.py View on Github external
def build(self):
        self.title = "Button Event Demo"
        self.root = Builder.load_file('button_event.kv')
        return self.root
github kivy / kivy-designer / designer / uix / py_console.py View on Github external
ListProperty,
    NumericProperty,
    ObjectProperty,
    partial,
)
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.codeinput import CodeInput
from pygments.lexers.python import PythonConsoleLexer


try:
    from rlcompleter import Completer
except ImportError:
    Completer = None

Builder.load_string('''
:
    text_input: interactive_text_input
    scroll_view: scroll_view
    ScrollView:
        id: scroll_view
        InteractiveShellInput:
            id: interactive_text_input
            size_hint: (1, None)
            font_size: root.font_size
            foreground_color: root.foreground_color
            background_color: root.background_color
            height: max(self.parent.height, self.minimum_height)
            on_ready_to_input: root.ready_to_input()
            sh: root.sh
''')
github cruor99 / sadpandareader / app / kivymd / navigationdrawer.py View on Github external
from kivy.lang import Builder
from kivy.metrics import dp
from kivy.properties import StringProperty, ObjectProperty, NumericProperty, ListProperty, BooleanProperty,\
    OptionProperty, Clock
from kivy.uix.boxlayout import BoxLayout

from YourApp.kivymd import images_path
from YourApp.kivymd.elevationbehavior import RectangularElevationBehavior
from YourApp.kivymd.icon_definitions import md_icons
from YourApp.kivymd.label import MDLabel
from YourApp.kivymd.list import BaseListItem, ILeftBody, OneLineListItem, OneLineIconListItem, IRightBody
from YourApp.kivymd.theming import ThemableBehavior
from YourApp.kivymd.toolbar import Toolbar
from YourApp.kivymd.vendor.navigationdrawer import (NavigationDrawer as VendorNavigationDrawer)

Builder.load_string("""
#:import Toolbar YourApp.kivymd.toolbar.Toolbar
#:import MDList YourApp.kivymd.list.MDList
#:import OneLineIconListItem YourApp.kivymd.list.OneLineIconListItem
#:import colors YourApp.kivymd.color_definitions.colors
#:import get_color_from_hex kivy.utils.get_color_from_hex
#:import ScrollView kivy.uix.scrollview.ScrollView
#:import Window kivy.core.window.Window


    elevation: 0
    specific_text_color: root.theme_cls.secondary_text_color
    opposite_colors: False
    title_theme_color: 'Secondary'
    md_bg_color: root.theme_cls.bg_light
    canvas:
        Color:
github kivy / kivy / kivy / adapters / objectadapter.py View on Github external
if self.obj is None:
            return None

        obj_args = None
        if self.args_converter:
            obj_args = self.args_converter(self.obj)
        else:
            obj_args = self.obj

        if self.cls:
            print 'CREATE VIEW FOR', self.obj
            print 'obj_args', obj_args
            instance = self.cls(**obj_args)
            return instance
        else:
            return Builder.template(self.template, **obj_args)
github spesmilo / electrum / electrum / gui / kivy / uix / gridview.py View on Github external
from kivy.uix.boxlayout import BoxLayout
from kivy.adapters.dictadapter import DictAdapter
from kivy.adapters.listadapter import ListAdapter
from kivy.properties import ObjectProperty, ListProperty, AliasProperty
from kivy.uix.listview import (ListItemButton, ListItemLabel, CompositeListItem,
                               ListView)
from kivy.lang import Builder
from kivy.metrics import dp, sp

Builder.load_string('''

    header_view: header_view
    content_view: content_view
    BoxLayout:
        orientation: 'vertical'
        padding: '0dp', '2dp'
        BoxLayout:
            id: header_box
            orientation: 'vertical'
            size_hint: 1, None
            height: '30dp'
            ListView:
                id: header_view
        BoxLayout:
            id: content_box
            orientation: 'vertical'