Das ist aus einer Steuerung im Maschinenbau. Der Steuerungsbauer bietet Python an, um Masken zu beschreiben und zu animieren.
Die Class attachToCell basiert auf GTK.
Code: Alles auswählen
class table(gtk.Table):
"""
This class returns a simple gtk.Table.
Parameter see gtk.Table
"""
instanceCounter = 0
def __init__(self,rows=1, columns=1, homogeneous=False):
#print 'INFO %s.%s() [%s]' %(type(self).__name__, sys._getframe().f_code.co_name, table.instanceCounter)
table.instanceCounter += 1
gtk.Table.__init__(self, rows=rows, columns=columns, homogeneous=homogeneous)
def __del__(self):
""" destructor """
#print 'INFO %s.%s() [%s]' %(type(self).__name__, sys._getframe().f_code.co_name, table.instanceCounter)
table.instanceCounter -= 1
def attachToCell (self, child, col, row, xoptions = gtk.FILL, yoptions = gtk.SHRINK, xpadding = 0, ypadding = 0, xalign = 0):
"""
Attach the child into a specified cell
"""
try: child.set_property( 'xalign' , xalign )
except: pass
left_attach = col
right_attach = col + 1
top_attach = row
bottom_attach = row + 1
self.attach(child, left_attach, right_attach, top_attach, bottom_attach, xoptions=xoptions, yoptions=yoptions, xpadding=xpadding, ypadding=ypadding)
self.show_all( )
self.attach(child <- da möchte ich hin, dass ich hier mehrere childs vom Typ plcimage übergeben kann....