wx position of items in list

M. Clift noone at here.com
Sun Oct 24 14:13:58 EDT 2004


Hi Alex,

Thanks for helping me again. I'm using the DragImage demo in wx. Here is
some of the code. I am getting the following error  regardless of whether I
use a list or string,  'unsupported operand type(s) for //: 'str' and
'int''.  I've also tried inserting \n into the text, but I can't get that to
work either.


    # Make a shape from some text
        text = ['a', 'b','c','d','z','y','a', 'b','c','d','z','y','a',
'b','c','d','z','y','a', 'b','c','d','z','y']
        text4 = " "+"".join(text)
        bg_colour = wx.Colour(57, 115, 57)  # matches the bg image
        font4 = wx.Font(36, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Arial")
        textExtent = self.GetFullTextExtent(text4, font4)

        # create a bitmap the same size as our text
        bmp4 = wx.EmptyBitmap(textExtent[0], textExtent[1])

        # 'draw' the text onto the bitmap
        dc = wx.MemoryDC()
        dc.SelectObject(bmp4)
        dc.SetBackground(wx.Brush(bg_colour, wx.SOLID))
        dc.Clear()
        dc.SetTextForeground(wx.BLACK)
        dc.SetFont(font4)
        dc.DrawText(text4, 0, 0)
        dc.SelectObject(wx.NullBitmap)
        mask4 = wx.Mask(bmp4, bg_colour)
        bmp4.SetMask(mask4)
        shape = DragShape(bmp4)
        shape.text = "Some dragging text"

        for i in text:
            shape.pos = (145, 170 + (i//2)*100)
            self.shapes.append(shape)

Thanks for your time,

Malcolm






More information about the Python-list mailing list