读书人

大侠请留步! wxpython:如何禁止控件

发布时间: 2012-06-06 16:44:11 作者: rapoo

大侠请留步!!! wxpython:怎么禁止控件拖出窗口外
按住鼠标左键拖动控件头部位置,就可将控件拖出界面,怎么样禁止啊

Python code
        self.Helper.CreateAuiManager([            mainUIHelper.AuiConfigModel(self.CreateLeft(), wx.aui.AuiPaneInfo()#AuiConfigModel实现过程在下面                                .Name("left")                                .Caption(u'测试工艺管理')                                .Left()                                .CloseButton(False)                                .MaximizeButton(False)                                                                ),             mainUIHelper.AuiConfigModel(self.CreateGrid(), wx.aui.AuiPaneInfo()                                .Name("gridContent")                                .CenterPane()                                .CloseButton(False)                                                                ),                        mainUIHelper.AuiConfigModel(self.CreateResultTextCtrl(), wx.aui.AuiPaneInfo()                                .Name("Result Window")                                .Caption(u'测试结果')                                .Right()                                .CloseButton(False)                                                                ),            mainUIHelper.AuiConfigModel(self.CreateTextCtrl(), wx.aui.AuiPaneInfo()                                .Name("Text")                                .Bottom()                                .Caption(u'测试过程')                                .CloseButton(False)                                                                )]);........................................................import wximport wx.aui;class MainUIHelper(object):        def __init__(self, frame):        object.__init__(self);                self.Frame = frame;        frame.Helper = self;    def CreateAuiManager(self, configs):        if(len(configs) > 0):            #制造Layout            self.AuiManager = wx.aui.AuiManager();            self.AuiManager.SetManagedWindow(self.Frame);            for c in configs:                self.AuiManager.AddPane(c.Control, c.PaneInfo);            self.AuiManager.Update();                class AuiConfigModel(object):        def __init__(self, control, paneInfo):        object.__init__(self);        self.Control = control;        self.PaneInfo = paneInfo;  


禁止控件拖出是 在定义 AuiConfigModel 这个时添加什么参数,还是在创建这个控件的时候添加什么参数?

[解决办法]
试试.Floatable(False),不过是整个禁止拖放pane到别处,在窗口内re-dock也不行。如果布局固定完全不要拖放,可以试试self.AuiManager = wx.aui.AuiManager(flags=0)...

读书人网 >perl python

热点推荐