that idea work just fine. but it seems that same concept to rotate and translate other widget does not work. here is a small example. Is it a bug in the pymt widget? how it is something that I’m doing wrong
from pymt import *
class MTContainer(MTScatterWidget):
#class ChartPlotArea(MTRectangularWidget):
def __init__(self, win, bgcolor=(.4,.9,.9, .8),**kwargs):
super(MTContainer, self).__init__(**kwargs)
#kwargs.setdefault('pos', (0,0))
self.rotation = 45
self.object = MTSquare()
self.add_widget(self.object)
self.i = 20
def draw(self):
for j in range(self.i):
self.object.draw()
self.rotation += (j*2)
self.rotation += (j*2)
self.translation = (j*3,j*3)
self.pos = (j*4, j*4)
#self.updateView()
#drawRectangle(pos=self.pos, size=self.size)
def on_draw(self):
self.draw()
#
class MTSquare(MTWidget):
def __init__(self, **kwargs):
super(MTSquare, self).__init__(**kwargs)
#self.size = self.get_parent_window()
self.color = (1.0, 1.0, 1.0, 0.5)
def draw(self):
drawLine((40, 40, 80, 40), width=1.0)
drawLine((80, 40, 80, 80), width=1.0)
drawLine((80, 80, 40, 80), width=1.0)
drawLine((40, 80, 40, 40), width=1.0)
def on_draw(self):
self.draw()
def pymt_plugin_activate(root, ctx):
ctx.c = MTKinetic()
container = MTContainer(ctx.c,
rotation = 45.0,
translation = (0,0),
scale = 1.0,
do_rotation = True,
do_translation = True,
do_scale = True,
auto_bring_to_front = True,
scale_min = 0.01,
pos=(50,50))
ctx.c.add_widget(container)
root.add_widget(ctx.c)
def pymt_plugin_deactivate(root, ctx):
root.remove_widget(ctx.ui)
if __name__ == '__main__':
w = MTWindow()
ctx = MTContext()
pymt_plugin_activate(w, ctx)
runTouchApp()
pymt_plugin_deactivate(w, ctx)
what do you think??? Thanks in advance.