本文整理汇总了Python中wx.EVT_CHAR属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_CHAR属性的具体用法?Python wx.EVT_CHAR怎么用?Python wx.EVT_CHAR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_CHAR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self, parent, id):
style = wx.WANTS_CHARS | wx.FULL_REPAINT_ON_RESIZE | wx.NO_BORDER
wx.Control.__init__(self, parent, id, style = style)
self.panel = parent
wx.EVT_SIZE(self, self.OnSize)
wx.EVT_PAINT(self, self.OnPaint)
wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
wx.EVT_LEFT_UP(self, self.OnLeftUp)
wx.EVT_LEFT_DCLICK(self, self.OnLeftDown)
wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
wx.EVT_MOTION(self, self.OnMotion)
wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)
wx.EVT_CHAR(self, self.OnKeyChar)
self.createEmptySp()
self.updateScreen(redraw = False)
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self, parent, content='', *args, **kwargs):
GUI.ChildWindow.__init__(self, parent, *args, **kwargs)
tc = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY)
def tc_OnChar(e):
keyInput = e.GetKeyCode()
if keyInput == 1: # Ctrl+A
tc.SelectAll()
else:
e.Skip()
tc.Bind(wx.EVT_CHAR, tc_OnChar)
def tc_OnFocus(e):
tc.ShowNativeCaret(False)
e.Skip()
tc.Bind(wx.EVT_SET_FOCUS, tc_OnFocus)
tc.SetValue(content)
#self.Center()
self.CenterOnScreen()
self.Show()
示例3: _create_textctrl
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def _create_textctrl(self, style=None, event_handler=None):
if style is None:
textctrl = wx.TextCtrl(self._panel)
else:
textctrl = wx.TextCtrl(self._panel, style=style)
if event_handler is not None:
textctrl.Bind(wx.EVT_TEXT_PASTE, event_handler)
textctrl.Bind(wx.EVT_MIDDLE_DOWN, event_handler)
if os.name == 'nt':
# Enable CTRL+A on Windows
def win_ctrla_eventhandler(event):
if event.GetKeyCode() == wx.WXK_CONTROL_A:
event.GetEventObject().SelectAll()
event.Skip()
textctrl.Bind(wx.EVT_CHAR, win_ctrla_eventhandler)
return textctrl
示例4: create_text_ctrl
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def create_text_ctrl(self, panel, value):
style = 0
if self.readonly: style = wx.TE_READONLY
if self.multiline: style |= wx.TE_MULTILINE
else: style |= wx.TE_PROCESS_ENTER
if not self._HORIZONTAL_LAYOUT: style |= wx.HSCROLL
if self.multiline=="grow":
text = ExpandoTextCtrl( panel, -1, value or "", style=style )
#text.Bind(EVT_ETC_LAYOUT_NEEDED, self.on_layout_needed)
text.SetWindowStyle(wx.TE_MULTILINE | wx.TE_RICH2)
text.SetMaxHeight(200)
else:
text = wx.TextCtrl( panel, -1, value or "", style=style )
# bind KILL_FOCUS and Enter for non-multilines
text.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus)
text.Bind(wx.EVT_SET_FOCUS, self.on_focus)
# XXX
text.Bind(wx.EVT_CHAR, self.on_char)
text.Bind(wx.EVT_TEXT, self._on_text)
return text
示例5: _on_text_click
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def _on_text_click(self, event):
if self.deactivated and not self.auto_activated and self.text:
text_rect = self.text.GetClientRect()
text_rect.Offset(self.text.Position)
if text_rect.Contains(event.Position):
self.toggle_active(active=True)
return
event.Skip()
#class ListBoxProperty(ComboBoxProperty):
#def __init__(self, value="", choices=[], default_value=_DefaultArgument, name=None):
#self.choices = choices
#TextProperty.__init__(self, value, False, default_value, name)
#def create_text_ctrl(self, panel, value):
#style = wx.LB_SINGLE
#combo = wx.ListBox( panel, -1, self.value, choices=self.choices, style=style )
#combo.Bind(wx.EVT_LISTBOX, self.on_combobox)
##combo.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus)
##combo.Bind(wx.EVT_CHAR, self.on_char)
#return combo
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self, parent, text, title, validateFunc = None):
wx.Dialog.__init__(self, parent, -1, title,
style = wx.DEFAULT_DIALOG_STYLE | wx.WANTS_CHARS)
# function to call to validate the input string on OK. can be
# None, in which case it is not called. if it returns "", the
# input is valid, otherwise the string it returns is displayed in
# a message box and the dialog is not closed.
self.validateFunc = validateFunc
vsizer = wx.BoxSizer(wx.VERTICAL)
vsizer.Add(wx.StaticText(self, -1, text), 1, wx.EXPAND | wx.BOTTOM, 5)
self.tc = wx.TextCtrl(self, -1, style = wx.TE_PROCESS_ENTER)
vsizer.Add(self.tc, 1, wx.EXPAND);
vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
cancelBtn = gutil.createStockButton(self, "Cancel")
hsizer.Add(cancelBtn)
okBtn = gutil.createStockButton(self, "OK")
hsizer.Add(okBtn, 0, wx.LEFT, 10)
vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 5)
util.finishWindow(self, vsizer)
wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
wx.EVT_TEXT_ENTER(self, self.tc.GetId(), self.OnOK)
wx.EVT_CHAR(self.tc, self.OnCharEntry)
wx.EVT_CHAR(cancelBtn, self.OnCharButton)
wx.EVT_CHAR(okBtn, self.OnCharButton)
self.tc.SetFocus()
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self):
wx.PyValidator.__init__(self)
self.Bind(wx.EVT_CHAR, self.OnChar)
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self):
"""Initialize the validator
"""
super(HexValidator, self).__init__()
# Event Handlers
self.Bind(wx.EVT_CHAR, self.OnChar)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self):
super(numOnlyValidator, self).__init__()
self.Bind(wx.EVT_CHAR, self.Validate)
# --------------------------------------------------------------------------
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self, parent, interpreter):
# begin wxGlade: MyFrame.__init__
wx.Panel.__init__(self, parent, -1)
self.history = []
self.index = 0
self.prompt = ">>"
self.textctrl = wx.TextCtrl(self, -1, '', style=wx.TE_PROCESS_ENTER | wx.TE_MULTILINE | wx.TE_RICH, size=(-1, 250))
self.textctrl.SetForegroundColour(wx.WHITE)
self.textctrl.SetBackgroundColour(wx.BLACK)
self.textctrl.AppendText(self.prompt)
self.textctrl.Bind(wx.EVT_CHAR, self.__bind_events)
sizer = wx.BoxSizer()
sizer.Add(self.textctrl, 1, wx.EXPAND)
self.SetSizer(sizer)
self._interp = interpreter
redir = RedirectText(self.textctrl)
import sys
# Create a replacement for stdin.
# self.reader = PseudoFileIn(self.readline, self.readlines)
# self.reader.input = ''
# self.reader.isreading = False
# sys.stdin=self.reader
sys.stdout = redir
sys.stderr = redir
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self, parent, option_name, config, setfunc):
wx.TextCtrl.__init__(self, parent)
self.option_name = option_name
self.config = config
self.setfunc = setfunc
self.SetValue(str(config[option_name]))
self.SetBestFittingSize((self.width,-1))
self.Bind(wx.EVT_CHAR, self.text_inserted)
self.Bind(wx.EVT_KILL_FOCUS, self.focus_out)
示例12: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self, torrent, parent, *a, **k):
self.torrent = torrent
k['style'] = k.get('style', wx.DEFAULT_FRAME_STYLE) | wx.WANTS_CHARS
BTFrameWithSizer.__init__(self, parent, *a, **k)
self.Bind(wx.EVT_CLOSE, self.close)
self.Bind(wx.EVT_CHAR, self.key)
self.panel.BindChildren(wx.EVT_CHAR, self.key)
if sys.platform == 'darwin':
self.sizer.AddSpacer((0, 14))
self.sizer.Layout()
self.Fit()
self.SetMinSize(self.GetSize())
示例13: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self, main_window, config, setfunc):
BTDialog.__init__(self, main_window, style=wx.DEFAULT_DIALOG_STYLE|wx.CLIP_CHILDREN|wx.WANTS_CHARS)
self.Bind(wx.EVT_CLOSE, self.close)
self.Bind(wx.EVT_CHAR, self.key)
self.SetTitle(_("%s Settings")%app_name)
self.setfunc = setfunc
self.config = config
self.notebook = wx.Notebook(self)
self.notebook.Bind(wx.EVT_CHAR, self.key)
self.general_panel = GeneralSettingsPanel(self.notebook)
self.saving_panel = SavingSettingsPanel(self.notebook)
self.network_panel = NetworkSettingsPanel(self.notebook)
self.appearance_panel = AppearanceSettingsPanel(self.notebook)
self.language_panel = LanguageSettingsPanel(self.notebook)
self.vbox = VSizer()
self.vbox.AddFirst(self.notebook, proportion=1, flag=wx.GROW)
self.vbox.Layout()
self.SetSizerAndFit(self.vbox)
self.SetFocus()
示例14: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def __init__(self, ctl, params):
Validator.__init__(self, ctl)
if len(params):
self.len=int(params[0])
else:
self.len=99
self.chars="0123456789"
ctl.Bind(wx.EVT_CHAR, self.OnChar)
示例15: init_gl
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_CHAR [as 别名]
def init_gl(self):
print('creating Frame')
self.window = wx.Frame ( parent=None, id=wx.ID_ANY, title=self.title,
style=wx.DEFAULT_FRAME_STYLE|wx.WS_EX_PROCESS_IDLE )
print('creating GLCanvas')
self.canvas = glcanvas.GLCanvas ( self.window, glcanvas.WX_GL_RGBA )
print('creating GLContext')
self.context = glcanvas.GLContext(self.canvas)
self.canvas.SetFocus()
self.window.SetSize ( (self.renderer.window_size[0], self.renderer.window_size[1]) )
print('showing Frame')
self.window.Show(True)
print('calling SetTopWindow')
self.SetTopWindow(self.window)
self.Bind ( wx.EVT_CHAR, self.OnChar )
self.canvas.Bind ( wx.EVT_SIZE, self.OnCanvasSize )
self.canvas.Bind ( wx.EVT_PAINT, self.OnCanvasPaint )
wx.IdleEvent.SetMode ( wx.IDLE_PROCESS_SPECIFIED )
self.Bind ( wx.EVT_IDLE, self.OnIdle )
print('making context current')
self.canvas.SetCurrent ( self.context )
self.renderer.init_gl()