当前位置: 首页>>代码示例>>Python>>正文


Python wx.Sizer方法代码示例

本文整理汇总了Python中wx.Sizer方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Sizer方法的具体用法?Python wx.Sizer怎么用?Python wx.Sizer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.Sizer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Add

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Sizer [as 别名]
def Add(self, widget, pos, span, flag, border, destroy=False):
        "Add to sizer, re-use existing SizerItem if there is one; pos is (row,col)"
        if isinstance(pos, int):
            pos = self.parent._get_row_col(pos)
        old_sizer_item = self._grid.FindItemAtPosition(pos)
        if old_sizer_item:
            if destroy:
                old_window = old_sizer_item.GetWindow()
                if old_window:
                    compat.DestroyLater(old_window)
            old_sizer_item.SetSpan((1,1))
            old_sizer_item.SetFlag(wx.EXPAND)
            old_sizer_item.SetBorder(border)
            if isinstance(widget, wx.Sizer):
                old_sizer_item.AssignSizer(widget)
            else:
                old_sizer_item.AssignWindow(widget)
        else:
            self._grid.Add( widget, pos, span, flag, border ) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:21,代码来源:edit_sizers.py

示例2: _reparent_widget

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Sizer [as 别名]
def _reparent_widget(self, widget):
        "call Reparent(self.widget) for all direct children, including those in sizers"
        if isinstance(widget, wx.Window):
            widget.Reparent(self.widget)
        elif isinstance(widget, wx.Sizer):
            if isinstance(widget, wx.StaticBoxSizer):
                # the StaticBox is a widget
                sb = widget.GetStaticBox()
                sb.Reparent(self.widget)
            # go through all children
            for si in widget.GetChildren():
                if si is None: continue
                child = si.GetWindow() or si.GetSizer()
                if child: self._reparent_widget(child) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:16,代码来源:edit_windows.py

示例3: _create_popup_menu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Sizer [as 别名]
def _create_popup_menu(self, widget):
        # remove, hide
        menu = misc.wxGladePopupMenu(self.name)
        widgetclass = self.__class__.__name__.lstrip("Edit")

        if self.widget and self.is_visible():
            # hide window
            i = misc.append_menu_item(menu, -1, _('Hide Design Window'))
            misc.bind_menu_item_after(widget, i, self.hide_widget)
        else:
            i = misc.append_menu_item(menu, -1, _('Show Design Window'))
            misc.bind_menu_item_after(widget, i, common.app_tree.show_toplevel, None, self)

        menu.AppendSeparator()
        i = misc.append_menu_item(menu, -1, _('Remove %s\tDel')%widgetclass, wx.ART_DELETE)
        misc.bind_menu_item_after(widget, i, self.remove)

        i = misc.append_menu_item(menu, -1, _('Duplicate %s')%widgetclass, wx.ART_COPY)
        misc.bind_menu_item_after(widget, i, self.duplicate)

        # paste
        i = misc.append_menu_item(menu, -1, _('Paste Sizer\tCtrl+V'), wx.ART_PASTE)
        misc.bind_menu_item_after(widget, i, clipboard.paste, self)
        # XXX change later on to allow other widgets to be pasted
        if self.children or not clipboard.check("sizer"): i.Enable(False)

        # preview
        menu.AppendSeparator()
        i = misc.append_menu_item(menu, -1, _('Preview %s\tF5'%widgetclass))
        misc.bind_menu_item(widget, i, self.preview_parent)

        return menu 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:34,代码来源:edit_windows.py

示例4: check_compatibility

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Sizer [as 别名]
def check_compatibility(self, widget, typename=None):
        "check in advance whether widget can be pasted"

        if widget is not None:
            if widget.WX_CLASS=="wxMenuBar":   typename = "menubar"
            elif widget.WX_CLASS=="wxToolBar": typename = "toolbar"

        if typename in ("menubar", "toolbar"):
            if not typename in self.properties:
                return (False, "Can't set a menu or tool bar")
            if self.check_prop(typename) and getattr(self, typename):
                return (False, 'Menu or tool bar already set for this window')
            return (True, None)

        if widget and widget.IS_TOPLEVEL:
            # a toplevel dragged internally on another toplevel -> just re-order
            return ("Reorder", None)

        if self.children and not self.children[0].IS_SLOT:
            return (False, 'Sizer or child widget already set for this window')

        if typename is not None:
            #if typename!="sizer":
                #return (False,'Only sizers can be pasted here')
            return (True,None)
        #import edit_sizers
        #if not isinstance(widget, edit_sizers.Sizer):
        #if not widget.IS_SIZER:
            #return (False, 'Only sizers can be pasted here')
        return (True,None) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:32,代码来源:edit_windows.py

示例5: check_drop_compatibility

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Sizer [as 别名]
def check_drop_compatibility(self):
        if self.children:
            return (False, 'Sizer or child widget already set for this window')
        #if common.adding_sizer:
        return (True, None)
        #return (False, 'Only sizers can be added here') 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:8,代码来源:edit_windows.py

示例6: get_toplevel_parent

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Sizer [as 别名]
def get_toplevel_parent(obj):
    if isinstance(obj, wx.Sizer):
        obj = obj.ContainingWindow
    elif not isinstance(obj, wx.Window):
        obj = obj.widget
    if hasattr(obj, "ContainingWindow"):
        obj = obj.ContainingWindow
    while obj and not obj.IsTopLevel():
        obj = obj.GetParent()
    return obj 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:12,代码来源:misc.py


注:本文中的wx.Sizer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。