本文整理汇总了Python中wx.DefaultValidator方法的典型用法代码示例。如果您正苦于以下问题:Python wx.DefaultValidator方法的具体用法?Python wx.DefaultValidator怎么用?Python wx.DefaultValidator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.DefaultValidator方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(self, parent, id=-1, colour=wx.BLACK,
pos=wx.DefaultPosition, size=wx.DefaultSize,
style = CLRP_DEFAULT_STYLE,
validator = wx.DefaultValidator,
name = "colourpickerwidget"):
wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1),
pos, size, style, validator, name)
self.SetColour(colour)
self.InvalidateBestSize()
self.SetInitialSize(size)
self.Bind(wx.EVT_BUTTON, self.OnButtonClick)
global _colourData
if _colourData is None:
_colourData = wx.ColourData()
_colourData.SetChooseFull(True)
grey = 0
for i in range(16):
c = wx.Colour(grey, grey, grey)
_colourData.SetCustomColour(i, c)
grey += 16
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(
self, parent,
id=-1,
pos=wx.DefaultPosition, size=wx.DefaultSize,
style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_VRULES|wx.LC_SINGLE_SEL,
validator=wx.DefaultValidator,
columns=None,
sortOrder=None,
name=_("ProfileView"),
):
wx.ListCtrl.__init__(self, parent, id, pos, size, style, validator,
name)
if columns is not None:
self.columns = columns
if not sortOrder:
sortOrder = [(x.defaultOrder,x) for x in self.columns if x.sortDefault]
self.sortOrder = sortOrder or []
self.sorted = []
self.CreateControls()
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(
self,
parent,
value=(255, 255, 255),
pos=wx.DefaultPosition,
size=(40, wx.Button.GetDefaultSize()[1]),
style=wx.BU_AUTODRAW,
validator=wx.DefaultValidator,
name="ColourSelectButton",
title = "Colour Picker"
):
self.value = value
self.title = title
wx.BitmapButton.__init__(
self, parent, -1, wx.NullBitmap, pos, size, style, validator, name
)
self.SetValue(value)
self.Bind(wx.EVT_BUTTON, self.OnButton)
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(
self,
parent,
id=-1,
pos=wx.DefaultPosition,
size=(40, wx.Button.GetDefaultSize()[1]),
style=wx.BU_AUTODRAW,
validator=wx.DefaultValidator,
name="FontSelectButton",
value=None
):
self.value = value
wx.BitmapButton.__init__(
self,
parent,
id,
GetInternalBitmap("font"),
pos,
size,
style,
validator,
name
)
self.Bind(wx.EVT_BUTTON, self.OnButton)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(self, parent, id=wx.ID_ANY, label="", pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator,
name="roundbutton"):
"""
Default class constructor.
:param `parent`: the L{RoundButton} parent;
:param `id`: window identifier. A value of -1 indicates a default value;
:param `label`: the button text label;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:param `style`: the button style (unused);
:param `validator`: the validator associated to the button;
:param `name`: the button name.
"""
wx.PyControl.__init__(self, parent, id, pos, size, style, validator, name)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_ERASE_BACKGROUND, lambda event: None)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
self.Bind(wx.EVT_SET_FOCUS, self.OnGainFocus)
self.Bind(wx.EVT_KILL_FOCUS, self.OnLoseFocus)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown)
self._mouseAction = None
self._hasFocus = False
self._buttonRadius = 0
self.SetLabel(label)
self.InheritAttributes()
self.SetInitialSize(size)
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize, choices=[], style=0, validator=wx.DefaultValidator, name=NAME):
super(ListBoxWithHeaders, self).__init__(parent, id, pos, size, [], style, validator, name)
self.__headers = set()
# Ignore all key events i'm bored to handle the header selection
self.Bind(wx.EVT_KEY_DOWN, lambda event: None)
# Make sure that a header is never selected
self.Bind(wx.EVT_LISTBOX, self._on_listbox)
for event in self.EVENTS:
self.Bind(event, self._disable_header_selection)
# Append the items in our own way in order to add the TEXT_PREFIX
self.AppendItems(choices)
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(
self,
parent = None,
id = -1,
label = "",
pos = (-1, -1),
size = (-1, -1),
choices = (),
majorDimension = 0,
style = wx.RA_SPECIFY_COLS,
validator = wx.DefaultValidator,
name = "radioBox"
):
self.value = 0
wx.Panel.__init__(self, parent, id, pos, size, name=name)
sizer = self.sizer = wx.GridSizer(len(choices), 1, 6, 6)
style = wx.RB_GROUP
for i, choice in enumerate(choices):
radioButton = wx.RadioButton(self, i, choice, style=style)
style = 0
self.sizer.Add(radioButton, 0, wx.EXPAND)
radioButton.Bind(wx.EVT_RADIOBUTTON, self.OnSelect)
self.SetSizer(sizer)
self.SetAutoLayout(True)
sizer.Fit(self)
self.Layout()
self.SetMinSize(self.GetSize())
self.Bind(wx.EVT_SIZE, self.OnSize)
示例8: TextCtrl
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def TextCtrl(
self,
value="",
pos=wx.DefaultPosition,
size=(150, -1),
style=0,
validator=wx.DefaultValidator,
name=wx.TextCtrlNameStr
):
"""
Returns a wx.TextCtrl control.
"""
return wx.TextCtrl(self, -1, value, pos, size, style, validator, name)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(
self,
parent,
id=-1,
value=0.0,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.TE_RIGHT,
validator=wx.DefaultValidator,
name="eg.SmartSpinNumCtrl",
**kwargs
):
self.initValue = value
self.value = value
self.parent = parent
self.kwargs = kwargs
self.name = name
self.nW = size[0] if size[0] != -1 else 60
self.tW = size[0] if size[0] != -1 else 120
if 'numWidth' in self.kwargs:
self.nW = self.kwargs['numWidth']
del self.kwargs['numWidth']
if 'textWidth' in self.kwargs:
self.tW = self.kwargs['textWidth']
del self.kwargs['textWidth']
wx.Window.__init__(self, parent, id, pos, size, 0)
self.SetThemeEnabled(True)
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
self.SetSizer(self.sizer)
self.ctrl = self.CreateCtrl(int(not isinstance(value, (int, float))))
self.Bind(wx.EVT_SIZE, self.OnSize)
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DefaultValidator [as 别名]
def __init__(
self,
parent,
id=-1,
key = _winreg.HKEY_CURRENT_USER,
subkey = "Software",
valueName = None,
pos = wx.DefaultPosition,
size = wx.DefaultSize,
style = wx.TR_HAS_BUTTONS,
validator = wx.DefaultValidator,
name="RegistryLazyTree",
text = None
):
self.text = text
wx.TreeCtrl.__init__(
self, parent, id, pos, size, style, validator, name
)
self.imageList = imageList = wx.ImageList(16, 16)
rootIcon = imageList.Add(eg.Icons.GetInternalBitmap("root"))
self.folderIcon = imageList.Add(eg.Icons.GetInternalBitmap("folder"))
self.valueIcon = imageList.Add(eg.Icons.GetInternalBitmap("action"))
self.SetImageList(imageList)
self.SetMinSize((-1, 200))
self.treeRoot = self.AddRoot(
"Registry",
image = rootIcon,
data = wx.TreeItemData((True, None, None, None))
)
#Adding keys
for item in regKeys:
#a tupel of 4 values is assigned to every item
#1) stores if the key has yet to be queried for subkey, when
# selected
#2) _winreg.hkey constant
#3) name of the key
#4) value name, None if just a key, empty string for default value
tmp = self.AppendItem(
self.treeRoot,
item[1],
image = self.folderIcon,
data =wx.TreeItemData((False, item[0], "", None))
)
self.SetItemHasChildren(tmp, True)
if item[0] == key:
self.SelectItem(tmp)
#select old value in tree
self.OnTreeChange(wx.CommandEvent(), key, subkey, valueName)
self.EnsureVisible(self.GetSelection())
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeChange)
self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnExpandNode)