use of anchors

Hi Everyone
I'd like to make one button to change position by mouse and resize it
by anchors.
I followed instructions of help documentation but it doesn't work.
Could anybody help me?
My code is as followes.

Thank you very much

···

------------------------------------------------------------------------------------
import wx
from wx.lib.anchors import LayoutAnchors

class MyButton(wx.Button):
    def __init__(self, parent, id, label, pos):
        wx.Button.__init__(self, parent, id, label, pos)

        self.SetConstraints(LayoutAnchors(self, left = 1,top = 1,right
= 1,bottom = 1))
        self.SetAutoLayout(True)

    #def OnClicked(self, event):
    # print 'Event of button control'

class AnchorTest(wx.Frame):
    def __init__ (self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size = (250, 150))

        panel = wx.Panel(self, -1)

        MyButton(panel, -1, 'OK', wx.DefaultPosition)

        self.Centre()
        self.Show(True)

app = wx.App()
AnchorTest(None, -1, 'Anchortest')
app.MainLoop()

I don't think that your definition of "anchors" matches what is implemented in wx.lib.anchors.

The anchors in that module are simply a layout mechanism (built on top of layout contraints) that can automatically size and position widgets in relation to their sibling widgets and their parent. They fulfill the same role that the more popular sizer classes do. See the LayoutAnchors sample in the demo for an example.

···

On 8/23/10 4:47 PM, Fresh73 wrote:

Hi Everyone
I'd like to make one button to change position by mouse and resize it
by anchors.
I followed instructions of help documentation but it doesn't work.
Could anybody help me?

--
Robin Dunn
Software Craftsman