本文整理汇总了Python中wx.Window方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Window方法的具体用法?Python wx.Window怎么用?Python wx.Window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.Window方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent, id, getCfgGui):
wx.Window.__init__(self, parent, id, size = (MyStatus.WIDTH, TAB_BAR_HEIGHT),
style = wx.FULL_REPAINT_ON_RESIZE)
self.getCfgGui = getCfgGui
self.page = 0
self.pageCnt = 0
self.elemType = ""
self.tabNext = ""
self.enterNext = ""
self.elementFont = util.createPixelFont(
TAB_BAR_HEIGHT // 2 + 6, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)
self.font = util.createPixelFont(
TAB_BAR_HEIGHT // 2 + 2, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)
wx.EVT_PAINT(self, self.OnPaint)
示例2: _getattr
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def _getattr(self, name):
if isinstance(name, wx.Window):
ctl=name
else:
ctl=self.ctl(name)
if ctl:
if ctl.validator:
return ctl.validator.GetValue()
elif isinstance(ctl, xmlres.getControlClass("whComboBox")):
return ctl.GetKeySelection()
elif isinstance(ctl, wx.StaticText):
return ctl.GetLabel()
elif isinstance(ctl, wx.RadioBox):
return ctl.GetSelection()
else:
return ctl.GetValue()
else:
try:
return object.__getattr__(self, name)
except AttributeError as _e:
if not name.startswith('_'):
raise AttributeError("%s has no attribute '%s'" % (str(self.__class__), name))
return None
示例3: OnChangeLdapValue
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def OnChangeLdapValue(self, ev):
if isinstance(ev, wx.Window):
ctl=ev
else:
ctl=ev.GetEventObject()
if ctl:
value=self._getattr(ctl)
if "rdn" in ctl.flags:
rdn="%s=%s" % (self.GetServer().GetName(ctl.ldapOid), value)
self.dialog.rdn=rdn
if value or "null" in ctl.flags:
if "multi" in ctl.flags:
value = value.splitlines()
self.dialog.SetValue(ctl.ldapOid, value, self)
for flag in ctl.flags:
if flag.startswith('copy='):
var=flag[5:]
if not self[var] or not self.dialog.node:
self.dialog.SetValue(var, value, self)
else:
self.dialog.DelValue(ctl.ldapOid, self)
self.dialog.OnCheck()
示例4: DoInsertPage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def DoInsertPage(self, page, pos):
if not isinstance(page, wx.Window):
page=page(self)
ctl=page.GetControl()
if pos == None:
self.AddPage(ctl, page.name)
self.pages.append(page)
else:
self.InsertPage(pos, ctl, page.name)
self.pages.insert(pos, page)
if isinstance(ctl, wx.ListCtrl):
ctl.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemDoubleClick)
ctl.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnItemRightClick)
ctl.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick)
if wx.Platform == "__WXMSW__":
ctl.Bind(wx.EVT_RIGHT_UP, self.OnItemRightClick)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent, index, label=None):
# XXX unify with EditBase.__init__ ?
assert isinstance(index, int)
assert not parent.IS_SLOT
np.PropertyOwner.__init__(self)
self.klass = self.classname = "slot"
self.label = label
# initialise instance properties
self.widget = None # Reference to the widget resembling the slot (a wx.Window)
self.name = "SLOT"
self.overlapped = False # for spanning in GridBagSizer
self.item = None
# initialise structure
self.parent = parent
self.children = None
self.parent.add_item(self, index)
#self.pos = np.LayoutPosProperty() # position within the sizer or 0
# the following are just set to use the same Add call as with widgets
self.proportion = 1
self.span = (1,1)
self.flag = wx.EXPAND
self.border = 0
示例6: create_widget
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def create_widget(self):
if self.overlapped and self.parent._IS_GRIDBAG: return
style = wx.FULL_REPAINT_ON_RESIZE
if self.parent.CHILDREN in (-1, 1): # e.g. Panel in a Frame
size = self.parent.widget.GetClientSize()
else:
size = (20, 20)
self.widget = wx.Window(self.parent_window.widget, -1, size=size, style=style)
self.widget.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
#self.widget.SetAutoLayout(True)
self.widget.Bind(wx.EVT_PAINT, self.on_paint)
self.widget.Bind(wx.EVT_ERASE_BACKGROUND, self.on_erase_background)
self.widget.Bind(wx.EVT_RIGHT_DOWN, self.popup_menu)
self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_drop_widget)
self.widget.Bind(wx.EVT_MIDDLE_DOWN, misc.exec_after(self.on_select_and_paste))
self.widget.Bind(wx.EVT_ENTER_WINDOW, self.on_enter)
self.widget.Bind(wx.EVT_LEAVE_WINDOW, self.on_leave)
#self.widget.Bind(wx.EVT_CHAR_HOOK, misc.on_key_down_event) # catch cursor keys XXX still required?
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent, label, title, mesg, treeLink=None):
if treeLink is None:
treeLink = eg.TreeLink(eg.Utils.GetTopLevelWindow(parent).treeItem)
self.treeLink = treeLink
self.macro = treeLink.target
if self.macro is None:
macroName = ""
else:
macroName = self.macro.name
self.title = title
self.mesg = mesg
wx.Window.__init__(self, parent, -1)
self.textBox = eg.StaticTextBox(self, -1, macroName, size=(200, -1))
self.button = wx.Button(self, -1, label)
self.Bind(wx.EVT_BUTTON, self.OnButton)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.textBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
sizer.Add(self.button, 0, wx.LEFT, 5)
self.SetSizer(sizer)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
self.Layout()
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent, label, title="", mesg="", imageString=None):
self.title = title
self.mesg = mesg
self.imageString = imageString
wx.Window.__init__(self, parent, -1)
self.button = wx.Button(self, -1, label)
self.imageBox = wx.StaticBitmap(
self, -1, size=(10, 10), style=wx.SUNKEN_BORDER
)
self.SetValue(imageString)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.button, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
sizer.Add(self.imageBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
self.SetSizer(sizer)
self.Bind(wx.EVT_BUTTON, self.OnButton)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
self.Layout()
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent, label, title, mesg, treeLink=None):
if treeLink is None:
treeLink = eg.TreeLink(eg.Utils.GetTopLevelWindow(parent).treeItem)
self.treeLink = treeLink
self.action = treeLink.target
if self.action is None:
actionName = ""
else:
actionName = self.action.GetLabel()
self.title = title
self.mesg = mesg
wx.Window.__init__(self, parent, -1)
self.textBox = eg.StaticTextBox(self, -1, actionName, size=(200, -1))
self.button = wx.Button(self, -1, label)
self.Bind(wx.EVT_BUTTON, self.OnButton)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.textBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
sizer.Add(self.button, 0, wx.LEFT, 5)
self.SetSizer(sizer)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
self.Layout()
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent):
wx.Window.__init__(self, parent, -1)
self.selected = None
# all valid characters
self.chars = ""
for i in xrange(256):
if util.isValidInputChar(i):
self.chars += chr(i)
self.cols = 16
self.rows = len(self.chars) // self.cols
if len(self.chars) % 16:
self.rows += 1
# offset of grid
self.offset = 5
# size of a single character cell
self.cellSize = 32
# size of the zoomed-in character boxes
self.boxSize = 60
self.smallFont = util.createPixelFont(18,
wx.FONTFAMILY_SWISS, wx.NORMAL, wx.NORMAL)
self.normalFont = util.createPixelFont(self.cellSize - 2,
wx.FONTFAMILY_MODERN, wx.NORMAL, wx.BOLD)
self.bigFont = util.createPixelFont(self.boxSize - 2,
wx.FONTFAMILY_MODERN, wx.NORMAL, wx.BOLD)
wx.EVT_PAINT(self, self.OnPaint)
wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
wx.EVT_MOTION(self, self.OnMotion)
wx.EVT_SIZE(self, self.OnSize)
util.setWH(self, self.cols * self.cellSize + 2 * self.offset, 460)
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent, ctrl, cfg):
wx.Window.__init__(self, parent, -1)
self.cfg = cfg
self.ctrl = ctrl
wx.EVT_SIZE(self, self.OnSize)
wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
wx.EVT_PAINT(self, self.OnPaint)
示例12: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent, bitmap=None, *a, **k):
wx.Window.__init__(self, parent, *a, **k)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.bitmap = None
if bitmap:
self.SetBitmap(bitmap)
else:
self.SetSize((0, 0))
示例13: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def __init__(self, parent, singleton=True, cols=1):
wx.Window.__init__(self, parent, wx.ID_ANY)
self.singleton = singleton
self.boxes = []
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(self.sizer)
self.buttonwin = wx.Window(self)
self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL)
self.buttonwin.SetSizer(self.buttonsizer)
self.sizer.Add(self.buttonwin)
if (not singleton):
self.value = Set()
self.selectall = wx.Button(self.buttonwin, label="select all");
self.selectall.Bind(wx.EVT_BUTTON, self.OnSelectAllNone)
self.buttonsizer.Add(self.selectall)
self.selectnone = wx.Button(self.buttonwin, label="select none");
self.selectnone.Bind(wx.EVT_BUTTON, self.OnSelectAllNone)
self.buttonsizer.Add(self.selectnone)
self.scrolled = wx.ScrolledWindow(self, wx.ID_ANY)
self.sizer.Add(self.scrolled, proportion=1, flag=wx.EXPAND|wx.ALL)
fontsz = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPixelSize()
self.scrolled.SetScrollRate(fontsz.x, fontsz.y)
self.scrollsizer = wx.GridSizer(cols=cols, hgap=5, vgap=5)
self.scrolled.SetSizer(self.scrollsizer)
示例14: BindMenuId
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def BindMenuId(self, proc, registerNew=False):
id= self.GetMenuId(proc, registerNew)
if not self.GetMenuProc(id):
self._menuProcs[id] = proc
wx.Window.Bind(self, wx.EVT_MENU, self.OnCall, id=id)
return id
示例15: _bind
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Window [as 别名]
def _bind(self, ctlName, evt=None, proc=None):
if isinstance(ctlName, wx.PyEventBinder): # binding to self
ctl=super(wx.Window, self)
proc=evt
evt=ctlName
elif isinstance(ctlName, wx.Window):
ctl=ctlName
else:
ctl=self[ctlName]
if not proc:
if not isinstance(evt, wx.PyEventBinder):
proc=evt
evt=None
if not proc:
proc=self.OnCheck
if not evt:
if isinstance(ctl, wx.Button):
evt=wx.EVT_BUTTON
elif isinstance(ctl, wx.CheckBox):
evt=wx.EVT_CHECKBOX
elif isinstance(ctl, wx.CheckListBox):
evt=wx.EVT_CHECKLISTBOX
elif isinstance(ctl, wx.RadioButton):
evt=wx.EVT_RADIOBUTTON
else:
evt=wx.EVT_TEXT
if isinstance(ctl, wx.ComboBox):
ctl.Bind(wx.EVT_COMBOBOX, proc)
ctl.Bind(evt, proc)