Scatter package: provide lot of widgets based on scatter (base, svg, plane, image...)
Bases: pymt.ui.widgets.scatter.MTScatter
This class is deprecated, you should use MTScatter now.
Bases: pymt.ui.widgets.scatter.MTScatterWidget
Render an svg image into a scatter widget
| Parameters : |
|
|---|
Bases: pymt.ui.widgets.scatter.MTScatterWidget
A Plane that transforms for zoom/rotate/pan. if none of the childwidgets handles the input (the background is touched), all of them are transformed together
Bases: pymt.ui.widgets.scatter.MTScatterWidget
MTScatterImage is a image showed in a Scatter widget
| Parameters : |
|
|---|
Bases: pymt.ui.widgets.widget.MTWidget
MTScatter is a scatter widget based on MTWidget. You can scale, rotate and move with one and two finger.
| Parameters : |
|
|---|---|
| Events : |
|
Update matrix transformation by adding new angle, scale and translate.
| Parameters : |
|
|---|
Transforms scatter by trans (on top of its current transformation state)
| Parameters : |
|
|---|
Returns the bounding box of the widget in parent space
((x, y), (w, h)
# x, y = lower left corner
Determines whether user interaction can rotate the widget
Determines whether user interaction can scale the widget
Determines whether user interaction can translate the widget
Object position (x, y). Lower left of bounding box for rotated scatter
Get/set the rotation around center of the object (in degree)
Get/set the scale factor of the object
Save/restore the state of matrix widget (require numpy)
Get/Set transformation matrix (numpy matrix)
Return the transformation matrix for OpenGL, read only.
Inverse of transformation matrix (numpy matrix), read only.
Return the inverse transformation matrix for OpenGL, read only.
..deprecated:: 0.5 Use transform_gl for an OpenGL transformation instead.
Update inverse and OpenGL matrices, from the current transformation. If you change manually the transformation, you should call this function, or the drawing will failed.
File ui_widgets_scatter_image.py
from pymt import *
import os
# just get the image
current_dir = os.path.dirname(__file__)
filename = os.path.join(current_dir, 'image.jpg')
# create 2 scatter with image
m = MTScatterImage(filename=filename, opacity=.5)
m2 = MTScatterImage(filename=filename, pos=(100, 100))
win = getWindow()
win.add_widget(m)
win.add_widget(m2)
runTouchApp()
from pymt import *
# force background draw for scatter
css_add_sheet('''
scatterwidget {
draw-background: 1;
}''')
# add a simple scatter
scatter = MTScatterWidget(size=(300, 300))
runTouchApp(scatter)
File ui_widgets_scatter_children.py
from pymt import *
# force background draw for scatter
css_add_sheet('''
scatterwidget {
draw-background: 1;
}''')
# add a simple scatter
scatter = MTScatterWidget(size=(300, 300), pos=(100, 100), rotation=45)
# add some children in
layout = MTBoxLayout()
layout.add_widget(MTButton(label='A1'))
layout.add_widget(MTButton(label='A2'))
scatter.add_widget(layout)
# now, the scatter is rotated, and the button too.
# it's still possible to click on the button, even
# if they are rotated too
runTouchApp(scatter)