Thanks for the quick answere!

I have a Class that is a container of the two objects, but i don't
know how can i make a compositeObject from this. I tried to devie this
from some FloatCanvas object but always there was some errors in
executing, expecially AttributeError in my HostShape class.

How can i have the composite class from this?

At the moment the class is

class HostShape:
        def __init__(self, parent, point, testo, tipo):
                self.point=point
                (x,y)=point
                self.textPoint=(x,y-1)
                self.pluginPath = parent.pluginPath
                self.Canvas=parent.Canvas
                
                if tipo == 'host':
                        self.bmp = wx.Image(self.pluginPath +
'host.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()

                if tipo == 'router':
                        self.bmp = wx.Image(self.pluginPath +
'router.png',wx.BITMAP_TYPE_PNG).ConvertToBitmap()
                        
                self.shape=MovingBitmap(self.bmp, self.point, Height = 3.5, 
Position = "bc")
                self.Canvas.AddObject(self.shape)
                self.shape.Bind(FC.EVT_FC_LEFT_DOWN, parent.ObjectHit)  
                
                self.text = MovingText(testo, self.textPoint, Size = 1, 
Position = "tc")
                self.Canvas.AddObject(self.text)
                self.text.Bind(FC.EVT_FC_LEFT_DOWN, parent.ObjectHit)   

On 5/24/07, Gerber, HR, Mnr <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote:
> You should create a CompositDrawObject that contains the bitmap and text as 
> sub object.
> The _Draw method of the Composit must then call the _Draw of the sub objects.
>
> You can then create a composit object, add some sub objects to the composit, 
> add the composit to the canvas.
>
> Moving the composit object will the all sub object (text and bitmap)
>
> If you still make both (composit and text) hitable (both have to be added to 
> the canvas) it is possible to make is so that the text for example can be 
> moved independently of the bitmap, but both are moved when the bitmap is 
> moved.
>
> CompositObjects adds a lot of flexibility it is worth implementing it.
>
> Hope this helps
>
> Retief Gerber
> Lektor
> Lecturer
> Departement Elektriese en Elektroniese Ingenieurswese
> Department of Electrical and Electronic Engineering
>
> Tel: +27 21 808 4011 I Faks/Fax: +27 21 808 4981
> E-pos/E-mail: [EMAIL PROTECTED]
>
> Universiteit Stellenbosch University
> Privaat Sak/Private Bag X1 Matieland 7602
> Suid-Afrika/South Africa
> www.eng.sun.ac.za
>
>
>
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:floatcanvas-
> > [EMAIL PROTECTED] On Behalf Of Marco Meoni - Sbaush
> > Sent: 24 May 2007 12:42 PM
> > To: Mailing List for the wxPython Float Canvas.
> > Subject: [fc] Link two Binding Object
> >
> > Hi all.
> > Using the new MovingElements.py written by Chris in a previous mail i
> > draw a map with draggable bitmaps and draggable text
> >
> > For bitmaps i use this lines:
> >
> > self.shape=MovingBitmap (self.bmp, self.point, Height = 3.5, Position =
> > "bc")
> > self.Canvas.AddObject(self.shape)
> > self.shape.Bind(FC.EVT_FC_LEFT_DOWN, parent.ObjectHit)
> >
> > And for the text i use:
> >
> > self.text = MovingText (testo, self.textPoint, Size = 1, Position =
> > "tc")
> > self.Canvas.AddObject(self.text)
> > self.text.Bind(FC.EVT_FC_LEFT_DOWN, parent.ObjectHit)
> >
> > I wrote MovingText class like MovingBitmaps and like all
> > MovingElements...
> > class MovingText(FC.ScaledText, MovingObjectMixin,
> > ConnectorObjectMixin):
> >       pass
> >
> > So i have a bitmap and a text. I can drag and move these on the
> > canvas, and this works perfectly.
> >
> > Now i have a problem...
> >
> > How can i "link" the drag&move of the elements?
> > Explaining, i have the bitmap in a Point, like (x,y).
> > The text is under the bitmap, self.textPoint=(x,y-1).
> > I would that moving the bitmap, also the text could move itself, going
> > under the bitmap.
> > How can i do this? Is possible?
> >
> > Please ask if you don't have understand from my bad english.
> > --
> > Marco Meoni (Sbaush)
> > _______________________________________________
> > FloatCanvas mailing list
> > [email protected]
> > http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
> _______________________________________________
> FloatCanvas mailing list
> [email protected]
> http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
>


-- 
Marco Meoni (Sbaush)
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to