Quick search

Table Of Contents

Splitter

バージョン 1.5.0 で追加.

_images/splitter.jpg

The Splitter is a widget that helps you re-size it’s child widget/layout by letting you re-size it via dragging the boundary or double tapping the boundary. This widget is similar to the ScrollView in that it allows only one child widget.

Usage:

splitter = Splitter(sizable_from = 'right')
splitter.add_widget(layout_or_widget_instance)
splitter.min_size = 100
splitter.max_size = 250

To change the size of the strip/border used for resizing:

splitter.strip_size = '10pt'

To change its appearance:

splitter.strip_cls = your_custom_class

You can also change the appearance of the strip_cls, which defaults to SplitterStrip, by overriding the kv rule in your app:

<SplitterStrip>:
    horizontal: True if self.parent and self.parent.sizable_from[0] in ('t', 'b') else False
    background_normal: 'path to normal horizontal image' if self.horizontal else 'path to vertical normal image'
    background_down: 'path to pressed horizontal image' if self.horizontal else 'path to vertical pressed image'
class kivy.uix.splitter.Splitter(**kwargs)[ソース]

ベースクラス: kivy.uix.boxlayout.BoxLayout

See module documentation.

Events:
on_press:

Fired when the splitter is pressed.

on_release:

Fired when the splitter is released.

バージョン 1.6.0 で変更: Added on_press and on_release events.

border

Border used for the BorderImage graphics instruction.

This must be a list of four values: (bottom, right, top, left). Read the BorderImage instructions for more information about how to use it.

border is a ListProperty and defaults to (4, 4, 4, 4).

keep_within_parent

If True, will limit the splitter to stay within its parent widget.

keep_within_parent is a BooleanProperty and defaults to False.

バージョン 1.9.0 で追加.

max_size

Specifies the maximum size beyond which the widget is not resizable.

max_size is a NumericProperty and defaults to 500pt.

min_size

Specifies the minimum size beyond which the widget is not resizable.

min_size is a NumericProperty and defaults to 100pt.

rescale_with_parent

If True, will automatically change size to take up the same proportion of the parent widget when it is resized, while staying within min_size and max_size. As long as these attributes can be satisfied, this stops the Splitter from exceeding the parent size during rescaling.

rescale_with_parent is a BooleanProperty and defaults to False.

バージョン 1.9.0 で追加.

sizable_from

Specifies whether the widget is resizable. Options are: left, right, top or bottom

sizable_from is an OptionProperty and defaults to left.

strip_cls

Specifies the class of the resize Strip.

strip_cls is an kivy.properties.ObjectProperty and defaults to SplitterStrip, which is of type Button.

バージョン 1.8.0 で変更: If you set a string, the Factory will be used to resolve the class.

strip_size

Specifies the size of resize strip

strp_size is a NumericProperty defaults to 10pt