Scatter is a widget that you can translate, rotate and scale, with two or more fingers. This is the famous widget as you can see on many multitouch demo.
By default, the widget itself don’t have any graphical representation. The idea is to combine Scatter widget with other widget, like Image widget.
scatter = Scatter() image = Image(source=’sun.jpg’) scatter.add_widget(image)
You can also avoid some interaction, like rotation.
scatter = Scatter(do_rotation=False)
Or allow only translation.
scatter = Scatter(do_rotation=False, do_scale=False)
If you add and manipulate multiple scatter, you can have trouble if the scatter is behind another scatter. We have a property named Scatter.auto_bring_to_front that remove and re-add the scatter in his parent. The scatter will be on top as soon as you touch it.
We are using 32 bits matrix, in double representation. That’s mean, we have limitation for scaling. You cannot do infite scale down/up with our implementation. Generally, you don’t hit the minimum scale (because you don’t see it on the screen), but the maximum scale : 9.99506983235e+19 (2^66)
You can also limit the minimum and maximum zoom allowed.
scatter = Scatter(scale_min=.5, scale_max=3.)
Bases: kivy.uix.widget.Widget
Scatter class. See module documentation for more information.
Parameters : |
|
---|
Transforms scatter by trans (on top of its current transformation state)
Parameters : |
|
---|
If True, the widget will be automatically pushed on the top of parent widget list for drawing.
auto_bring_to_front is a BooleanProperty, default to True.
Bounding box of the widget in parent space
((x, y), (w, h))
# x, y = lower left corner
bbox is a AliasProperty.
Create a property with a custom getter and setter.
If you don’t found a Property class that fit to your needs, you can still create Python getter and setter, and create a property with both of them.
Exemple from the kivy/uix/widget.py
def get_right(self):
return self.x + self.width
def set_right(self, value):
self.x = value - self.width
right = AliasProperty(get_right, set_right, bind=(x, width))
Parameters : |
|
---|
Allow rotation
do_rotation is a BooleanProperty, default to True.
Allow scaling
do_scale is a BooleanProperty, default to True.
Allow translation on X or Y axis
do_translation is a AliasProperty of (do_translation_x + do_translation_y)
Allow translation on X axis
do_translation_x is a BooleanProperty, default to True.
Allow translation on Y axis
do_translation_y is a BooleanProperty, default to True.
Create a property with a custom getter and setter.
If you don’t found a Property class that fit to your needs, you can still create Python getter and setter, and create a property with both of them.
Exemple from the kivy/uix/widget.py
def get_right(self):
return self.x + self.width
def set_right(self, value):
self.x = value - self.width
right = AliasProperty(get_right, set_right, bind=(x, width))
Parameters : |
|
---|
Rotation value of the scatter
rotation is a AliasProperty.
Scale value of the scatter
scale is a AliasProperty.
Maximum scaling factor allowed
scale_max is a NumericProperty, default to 1e20
Minimum scaling factor allowed
scale_min is a NumericProperty, default to 0.01
Transformation matrix
transform is a ObjectProperty, default to the identity matrix.
Inverse of the transformation matrix
transform_inv is a ObjectProperty, default to the identity matrix.
Create a property with a custom getter and setter.
If you don’t found a Property class that fit to your needs, you can still create Python getter and setter, and create a property with both of them.
Exemple from the kivy/uix/widget.py
def get_right(self):
return self.x + self.width
def set_right(self, value):
self.x = value - self.width
right = AliasProperty(get_right, set_right, bind=(x, width))
Parameters : |
|
---|
Create a property with a custom getter and setter.
If you don’t found a Property class that fit to your needs, you can still create Python getter and setter, and create a property with both of them.
Exemple from the kivy/uix/widget.py
def get_right(self):
return self.x + self.width
def set_right(self, value):
self.x = value - self.width
right = AliasProperty(get_right, set_right, bind=(x, width))
Parameters : |
|
---|