本文整理汇总了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 )
示例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)
示例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
示例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)
示例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')
示例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