Python wx.EVT_CHAR Examples
The following are 28
code examples of wx.EVT_CHAR().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: trelby.py From trelby with GNU General Public License v2.0 | 7 votes |
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)
Example #2
Source File: new_properties.py From wxGlade with MIT License | 7 votes |
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
Example #3
Source File: gui.py From report-ng with GNU General Public License v2.0 | 6 votes |
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()
Example #4
Source File: mainframe.py From youtube-dl-gui with The Unlicense | 6 votes |
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
Example #5
Source File: new_properties.py From wxGlade with MIT License | 6 votes |
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
Example #6
Source File: SettingsWindow.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
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()
Example #7
Source File: viewer.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwds): wxtbx.utils.SettingsPanel.__init__(self, *args, **kwds) self.Bind(wx.EVT_CHAR, self.OnChar)
Example #8
Source File: geometry_viewer.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwds): wxtbx.utils.SettingsPanel.__init__(self, *args, **kwds) self.Bind(wx.EVT_CHAR, self.OnChar)
Example #9
Source File: ObjectListView.py From bookhub with MIT License | 5 votes |
def _ConfigureCellEditor(self, editor, bounds, rowIndex, subItemIndex): """ Perform the normal configuration on the cell editor. """ editor.SetDimensions(*bounds) colour = self.GetItemBackgroundColour(rowIndex) if colour.IsOk(): editor.SetBackgroundColour(colour) else: editor.SetBackgroundColour(self.GetBackgroundColour()) colour = self.GetItemTextColour(rowIndex) if colour.IsOk(): editor.SetForegroundColour(colour) else: editor.SetForegroundColour(self.GetTextColour()) font = self.GetItemFont(rowIndex) if font.IsOk(): editor.SetFont(font) else: editor.SetFont(self.GetFont()) if hasattr(self.cellEditor, "SelectAll"): self.cellEditor.SelectAll() editor.Bind(wx.EVT_CHAR, self._Editor_OnChar) editor.Bind(wx.EVT_COMMAND_ENTER, self._Editor_OnChar) editor.Bind(wx.EVT_KILL_FOCUS, self._Editor_KillFocus)
Example #10
Source File: CellEditor.py From bookhub with MIT License | 5 votes |
def __init__(self, acceptableChars="0123456789+-"): wx.PyValidator.__init__(self) self.Bind(wx.EVT_CHAR, self._OnChar) self.acceptableChars = acceptableChars self.acceptableCodes = [ord(x) for x in self.acceptableChars] stdEditKeys = [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER, wx.WXK_ESCAPE, wx.WXK_CANCEL, wx.WXK_TAB, wx.WXK_BACK, wx.WXK_DELETE, wx.WXK_HOME, wx.WXK_END, wx.WXK_LEFT, wx.WXK_RIGHT] self.acceptableCodes.extend(stdEditKeys)
Example #11
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__(self, maxLength=100, allowRaw=False): self.maxLength = maxLength self.allowRaw = allowRaw wx.PyValidator.__init__(self) self.Bind(wx.EVT_CHAR, self.OnChar)
Example #12
Source File: DigitOnlyValidator.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__(self, choices=None): wx.PyValidator.__init__(self) self.choices = choices self.Bind(wx.EVT_CHAR, self.OnChar)
Example #13
Source File: wx_app.py From pyopenvr with BSD 3-Clause "New" or "Revised" License | 5 votes |
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()
Example #14
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def create_text_ctrl(self, panel, value): combo = wx.ComboBox( panel, -1, self.value, choices=self.choices, style=self._CB_STYLE ) combo.SetStringSelection(self.value) combo.Bind(wx.EVT_COMBOBOX, self.on_combobox) combo.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus) combo.Bind(wx.EVT_SET_FOCUS, self.on_focus) combo.Bind(wx.EVT_CHAR, self.on_char) return combo
Example #15
Source File: Validator.py From admin4 with Apache License 2.0 | 5 votes |
def __init__(self, ctl, unused_params): Validator.__init__(self, ctl) self.len=17 self.chars="0123456789abcdef" ctl.Bind(wx.EVT_CHAR, self.OnChar)
Example #16
Source File: Validator.py From admin4 with Apache License 2.0 | 5 votes |
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)
Example #17
Source File: misc.py From trelby with GNU General Public License v2.0 | 5 votes |
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()
Example #18
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
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())
Example #19
Source File: __init__.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
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)
Example #20
Source File: guicontrols.py From wfuzz with GNU General Public License v2.0 | 5 votes |
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
Example #21
Source File: validators.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def __init__(self): super(numOnlyValidator, self).__init__() self.Bind(wx.EVT_CHAR, self.Validate) # --------------------------------------------------------------------------
Example #22
Source File: validators.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def __init__(self): super(numOnlyValidator, self).__init__() self.Bind(wx.EVT_CHAR, self.Validate) # --------------------------------------------------------------------------
Example #23
Source File: Util.py From pyResMan with GNU General Public License v2.0 | 5 votes |
def __init__(self): """Initialize the validator """ super(HexValidator, self).__init__() # Event Handlers self.Bind(wx.EVT_CHAR, self.OnChar)
Example #24
Source File: APDUHexValidator.py From pyscard with GNU Lesser General Public License v2.1 | 5 votes |
def __init__(self): wx.PyValidator.__init__(self) self.Bind(wx.EVT_CHAR, self.OnChar)
Example #25
Source File: misc.py From trelby with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, id, size): wx.Window.__init__(self, parent, id, size = size, style = wx.WANTS_CHARS) wx.EVT_CHAR(self, self.OnKeyChar)
Example #26
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 4 votes |
def __init__(self, main): BTDialog.__init__(self, main, size = (300,400), style=wx.DEFAULT_DIALOG_STYLE|wx.CLIP_CHILDREN|wx.WANTS_CHARS) self.Bind(wx.EVT_CLOSE, self.close) self.SetTitle(_("About %s")%app_name) self.sizer = VSizer() i = wx.the_app.image_library.get(('logo', 'banner')) b = wx.BitmapFromImage(i) self.bitmap = ElectroStaticBitmap(self, b) self.sizer.AddFirst(self.bitmap, flag=wx.ALIGN_CENTER_HORIZONTAL) version_str = version if int(version_str[2]) % 2: version_str = version_str + ' ' + _("Beta") if '__WXGTK__' in wx.PlatformInfo: # wtf, "Version" forces a line break before the # version_str on WXGTK only -- most other strings work # fine. version_text = _("version %s") % version_str else: version_text = _("Version %s") % version_str version_label = ElectroStaticText(self, label=version_text) self.sizer.Add(version_label, flag=wx.ALIGN_CENTER_HORIZONTAL) if branch is not None: blabel = ElectroStaticText(self, label='working dir: %s' % branch) self.sizer.Add(blabel, flag=wx.ALIGN_CENTER_HORIZONTAL) self.credits_scroll = CreditsScroll(self, 'credits', style=wx.TE_CENTRE) self.lic_scroll = CreditsScroll(self, 'LICENSE', style=wx.TE_CENTRE) self.sizer.Add(self.lic_scroll, flag=wx.GROW, proportion=1) self.sizer.Add(self.credits_scroll, flag=wx.GROW, proportion=1) self.lic_scroll.Hide() self.button_sizer = HSizer() self.credits_button = wx.Button(parent=self, id=wx.ID_ANY, label=_("Li&cense")) self.credits_button.Bind(wx.EVT_BUTTON, self.toggle_credits) self.button_sizer.AddFirst(self.credits_button) self.sizer.Add(self.button_sizer, flag=wx.ALIGN_CENTER_HORIZONTAL, proportion=0, border=0) self.SetSizerAndFit(self.sizer) for w in (self, self.bitmap, self.credits_scroll, self.credits_button): w.Bind(wx.EVT_CHAR, self.key) self.SetFocus()
Example #27
Source File: ConfigEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent, controler, position_column=False): wx.FlexGridSizer.__init__(self, cols=1, hgap=0, rows=2, vgap=5) self.AddGrowableCol(0) self.AddGrowableRow(1) self.Controler = controler self.PositionColumn = position_column self.VariablesFilter = wx.ComboBox(parent, style=wx.TE_PROCESS_ENTER) self.VariablesFilter.Bind(wx.EVT_COMBOBOX, self.OnVariablesFilterChanged) self.VariablesFilter.Bind(wx.EVT_TEXT_ENTER, self.OnVariablesFilterChanged) self.VariablesFilter.Bind(wx.EVT_CHAR, self.OnVariablesFilterKeyDown) self.AddWindow(self.VariablesFilter, flag=wx.GROW) self.VariablesGrid = wx.gizmos.TreeListCtrl(parent, style=wx.TR_DEFAULT_STYLE | wx.TR_ROW_LINES | wx.TR_COLUMN_LINES | wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT) self.VariablesGrid.GetMainWindow().Bind(wx.EVT_LEFT_DOWN, self.OnVariablesGridLeftClick) self.AddWindow(self.VariablesGrid, flag=wx.GROW) self.Filters = [] for desc, value in VARIABLES_FILTERS: self.VariablesFilter.Append(desc) self.Filters.append(value) self.VariablesFilter.SetSelection(0) self.CurrentFilter = self.Filters[0] self.VariablesFilterFirstCharacter = True if position_column: for colname, colsize, colalign in zip(GetVariablesTableColnames(position_column), [40, 80, 350, 80, 100, 80, 150], [wx.ALIGN_RIGHT, wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_RIGHT, wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]): self.VariablesGrid.AddColumn(_(colname), colsize, colalign) self.VariablesGrid.SetMainColumn(2) else: for colname, colsize, colalign in zip(GetVariablesTableColnames(), [40, 350, 80, 100, 80, 150], [wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_RIGHT, wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]): self.VariablesGrid.AddColumn(_(colname), colsize, colalign) self.VariablesGrid.SetMainColumn(1)
Example #28
Source File: hypercube.py From spectral with MIT License | 4 votes |
def __init__(self, data, parent, id, *args, **kwargs): global DEFAULT_WIN_SIZE self.kwargs = kwargs self.size = kwargs.get('size', DEFAULT_WIN_SIZE) self.title = kwargs.get('title', 'Hypercube') # # Forcing a specific style on the window. # Should this include styles passed? style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE wx.Frame.__init__(self, parent, id, self.title, wx.DefaultPosition, wx.Size(*self.size), style, kwargs.get('name', 'Hypercube')) self.gl_initialized = False attribs = (glcanvas.WX_GL_RGBA, # RGBA glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered glcanvas.WX_GL_DEPTH_SIZE, settings.WX_GL_DEPTH_SIZE) self.canvas = glcanvas.GLCanvas( self, attribList=attribs, size=self.size) self.canvas.context = wx.glcanvas.GLContext(self.canvas) # These members can be modified before calling the show method. self.clear_color = tuple(kwargs.get('background', (0., 0., 0.))) \ + (1.,) self.win_pos = (100, 100) self.fovy = 60. self.znear = 0.1 self.zfar = 10.0 self.target_pos = [0.0, 0.0, 0.0] self.camera_pos_rtp = [7.0, 45.0, 30.0] self.up = [0.0, 0.0, 1.0] self.hsi = data self.cubeHeight = 1.0 self.rotation = [-60, 0, -30] self.distance = -5 self.light = False self.texturesLoaded = False self.mouse_handler = MouseHandler(self) # Set the event handlers. self.canvas.Bind(wx.EVT_ERASE_BACKGROUND, self.on_erase_background) self.canvas.Bind(wx.EVT_SIZE, self.on_resize) self.canvas.Bind(wx.EVT_PAINT, self.on_paint) self.canvas.Bind(wx.EVT_LEFT_DOWN, self.mouse_handler.left_down) self.canvas.Bind(wx.EVT_LEFT_UP, self.mouse_handler.left_up) self.canvas.Bind(wx.EVT_MOTION, self.mouse_handler.motion) self.canvas.Bind(wx.EVT_CHAR, self.on_char)