Python wx.EVT_TEXT Examples
The following are 30
code examples of wx.EVT_TEXT().
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: cfgdlg.py From trelby with GNU General Public License v2.0 | 6 votes |
def addMarginCtrl(self, name, parent, sizer): sizer.Add(wx.StaticText(parent, -1, name + ":"), 0, wx.ALIGN_CENTER_VERTICAL) entry = wx.TextCtrl(parent, -1) sizer.Add(entry, 0) label = wx.StaticText(parent, -1, "mm") sizer.Add(label, 0, wx.ALIGN_CENTER_VERTICAL) entry2 = wx.TextCtrl(parent, -1) sizer.Add(entry2, 0, wx.LEFT, 20) label2 = wx.StaticText(parent, -1, "inch") sizer.Add(label2, 0, wx.ALIGN_CENTER_VERTICAL) setattr(self, name.lower() + "EntryMm", entry) setattr(self, name.lower() + "EntryInch", entry2) wx.EVT_TEXT(self, entry.GetId(), self.OnMarginMm) wx.EVT_TEXT(self, entry2.GetId(), self.OnMarginInch)
Example #2
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 6 votes |
def __init__(self, *a, **k): wx.LogWindow.__init__(self, *a, **k) frame = self.GetFrame() frame.SetIcon(wx.the_app.icon) frame.SetSize((900, 300)) frame.GetStatusBar().Destroy() # don't give all log messages to their previous handlers # we'll enable this as we need it. self.PassMessages(False) # YUCK. Why is the log window not really a window? # Because it's a wxLog. self.magic_window = self.GetFrame() for child in self.magic_window.GetChildren(): if isinstance(child, wx.TextCtrl): self.textctrl = child break # if this line crashes, we didn't find the textctrl. that means if we # continued anyway, we'd have a memory leak self.textctrl.Bind(wx.EVT_TEXT, self.OnText)
Example #3
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, torrent, *a, **k): BTPanel.__init__(self, parent, *a, **k) self.log = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2) self.log.Bind(wx.EVT_TEXT, self.OnText) self.Add(self.log, flag=wx.GROW, proportion=1) class MyTorrentLogger(logging.Handler): def set_log_func(self, func): self.log_func = func def emit(self, record): gui_wrap(self.log_func, self.format(record) + '\n') l = MyTorrentLogger() l.setFormatter(bt_log_fmt) l.set_log_func(self.log.AppendText) torrent.handler.setTarget(l) torrent.handler.flush()
Example #4
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, default_text, visit_url_func): wx.TextCtrl.__init__(self, parent, size=(150,-1), style=wx.TE_PROCESS_ENTER|wx.TE_RICH) self.default_text = default_text self.visit_url_func = visit_url_func self.reset_text(force=True) self._task = TaskSingleton() event = wx.SizeEvent((150, -1), self.GetId()) wx.PostEvent(self, event) self.old = self.GetValue() self.Bind(wx.EVT_TEXT, self.begin_edit) self.Bind(wx.EVT_SET_FOCUS, self.begin_edit) def focus_lost(event): gui_wrap(self.reset_text) self.Bind(wx.EVT_KILL_FOCUS, focus_lost) self.Bind(wx.EVT_TEXT_ENTER, self.search)
Example #5
Source File: statusbar.py From wxGlade with MIT License | 6 votes |
def __init__(self): global _NUMBER wx.Dialog.__init__(self, None, -1, _('Select toolbar class')) if common.root.language.lower() == 'xrc': klass = 'wxToolBar' else: klass = 'MyToolBar%s' % (_NUMBER or "") _NUMBER += 1 # class self.klass = wx.TextCtrl(self, -1, klass) self.klass.Bind(wx.EVT_TEXT, self.on_text) # layout szr = wx.BoxSizer(wx.VERTICAL) szr.Add(klass_prop.panel, 0, wx.EXPAND) sz2 = wx.BoxSizer(wx.HORIZONTAL) sz2.Add(wx.Button(self, wx.ID_OK, _('OK')), 0, wx.ALL, 3) sz2.Add(wx.Button(self, wx.ID_CANCEL, _('Cancel')), 0, wx.ALL, 3) szr.Add(sz2, 0, wx.ALL|wx.ALIGN_CENTER, 3) self.SetAutoLayout(True) self.SetSizer(szr) szr.Fit(self)
Example #6
Source File: g.gui.tangible.py From grass-tangible-landscape with GNU General Public License v2.0 | 6 votes |
def BindModelProperties(self): self.btnCalibrateTilt.Bind(wx.EVT_BUTTON, self.scaniface.Calibrate) self.btnCalibrateExtent.Bind(wx.EVT_BUTTON, self.scaniface.CalibrateModelBBox) # model parameters self.elevInput.Bind(wx.EVT_TEXT, self.OnModelProperties) self.regionInput.Bind(wx.EVT_TEXT, self.OnModelProperties) self.zexag.Bind(wx.EVT_TEXT, self.OnModelProperties) self.rotate.Bind(wx.EVT_SPINCTRL, self.OnModelProperties) self.rotate.Bind(wx.EVT_TEXT, self.OnModelProperties) self.numscans.Bind(wx.EVT_SPINCTRL, self.OnModelProperties) self.numscans.Bind(wx.EVT_TEXT, self.OnModelProperties) self.interpolate.Bind(wx.EVT_CHECKBOX, self.OnModelProperties) self.smooth.Bind(wx.EVT_TEXT, self.OnModelProperties) self.resolution.Bind(wx.EVT_TEXT, self.OnModelProperties) self.trim_tolerance.Bind(wx.EVT_TEXT, self.OnModelProperties) for each in 'nsewtb': self.trim[each].Bind(wx.EVT_TEXT, self.OnModelProperties)
Example #7
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def Configure(self, cmdLineArgs=""): vlcPath = GetVlcPath() panel = eg.ConfigPanel() cmdLineCtrl = panel.TextCtrl(cmdLineArgs) resultCtrl = eg.StaticTextBox(panel) def OnTextChange(event=None): cmdLineArgs = cmdLineCtrl.GetValue() cmdString = '"%s" %s' % (vlcPath, self.GetCmdLineArgs(cmdLineArgs)) resultCtrl.SetValue(cmdString) if event: event.Skip() OnTextChange() cmdLineCtrl.Bind(wx.EVT_TEXT, OnTextChange) panel.sizer.AddMany([ (panel.StaticText(self.text.additionalArgs), 0, wx.BOTTOM, 3), (cmdLineCtrl, 0, wx.EXPAND|wx.BOTTOM, 5), ((15, 15), ), (panel.StaticText(self.text.resultingCmdLine), 0, wx.BOTTOM, 3), (resultCtrl, 1, wx.EXPAND), ]) while panel.Affirmed(): panel.SetResult(cmdLineCtrl.GetValue())
Example #8
Source File: Terminal.py From meerk40t with MIT License | 6 votes |
def __init__(self, *args, **kwds): # begin wxGlade: Terminal.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_NO_TASKBAR | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((581, 410)) self.text_main = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_BESTWRAP | wx.TE_MULTILINE | wx.TE_READONLY) self.text_entry = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PROCESS_TAB) self.__set_properties() self.__do_layout() # self.Bind(wx.EVT_TEXT, self.on_key_down, self.text_entry) self.Bind(wx.EVT_CHAR_HOOK, self.on_key_down, self.text_entry) self.Bind(wx.EVT_TEXT_ENTER, self.on_entry, self.text_entry) # end wxGlade self.Bind(wx.EVT_CLOSE, self.on_close, self) self.pipe = None self.command_log = [] self.command_position = 0
Example #9
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 #10
Source File: preview.py From IkaLog with Apache License 2.0 | 6 votes |
def __init__(self, *args, **kwargs): wx.Panel.__init__(self, *args, **kwargs) # This is used to determine if a file dialog is open or not. self.prev_file_path = '' # Textbox for input file self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, '') self.text_ctrl.Bind(wx.EVT_TEXT, self.on_text_input) self.button = wx.Button(self, wx.ID_ANY, _('Browse')) self.button.Bind(wx.EVT_BUTTON, self.on_button_click) # Drag and drop drop_target = FileDropTarget(self) self.text_ctrl.SetDropTarget(drop_target) top_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.Add(self.text_ctrl, proportion=1) top_sizer.Add(self.button) self.SetSizer(top_sizer)
Example #11
Source File: params.py From admin4 with Apache License 2.0 | 6 votes |
def __init__(self, parent, name): pre = wx.PrePanel() g.frame.res.LoadOnPanel(pre, parent, 'PANEL_BITMAP') self.PostCreate(pre) self.modified = self.freeze = False self.radio_std = xrc.XRCCTRL(self, 'RADIO_STD') self.radio_file = xrc.XRCCTRL(self, 'RADIO_FILE') self.combo = xrc.XRCCTRL(self, 'COMBO_STD') self.text = xrc.XRCCTRL(self, 'TEXT_FILE') self.button = xrc.XRCCTRL(self, 'BUTTON_BROWSE') self.textModified = False self.SetAutoLayout(True) self.GetSizer().SetMinSize((260, -1)) self.GetSizer().Fit(self) wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_STD'), self.OnRadioStd) wx.EVT_RADIOBUTTON(self, xrc.XRCID('RADIO_FILE'), self.OnRadioFile) wx.EVT_BUTTON(self, xrc.XRCID('BUTTON_BROWSE'), self.OnButtonBrowse) wx.EVT_COMBOBOX(self, xrc.XRCID('COMBO_STD'), self.OnCombo) wx.EVT_TEXT(self, xrc.XRCID('COMBO_STD'), self.OnChange) wx.EVT_TEXT(self, xrc.XRCID('TEXT_FILE'), self.OnChange)
Example #12
Source File: search_ctrl.py From wxGlade with MIT License | 5 votes |
def finish_widget_creation(self, level, sel_marker_parent=None): ManagedBase.finish_widget_creation(self, sel_marker_parent) #self.widget.Bind(wx.EVT_SET_FOCUS, self.on_set_focus) self.widget.Bind(wx.EVT_CHILD_FOCUS, self.on_set_focus) #self.widget.Bind(wx.EVT_TEXT, self.on_set_focus)
Example #13
Source File: custom_widget.py From wxGlade with MIT License | 5 votes |
def __init__(self): title = _('Enter widget class') wx.Dialog.__init__(self, None, -1, title, wx.GetMousePosition()) klass = 'CustomWidget' self.classname = wx.TextCtrl(self, -1, klass) sizer = wx.BoxSizer(wx.VERTICAL) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(wx.StaticText(self, -1, _('class')), 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) hsizer.Add(self.classname, 1, wx.ALIGN_CENTER_VERTICAL|wx.TOP|wx.BOTTOM|wx.RIGHT, 3) sizer.Add(hsizer, 0, wx.EXPAND) # horizontal sizer for action buttons hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add( wx.Button(self, wx.ID_CANCEL, _('Cancel')), 1, wx.ALL, 5) self.OK_button = btn = wx.Button(self, wx.ID_OK, _('OK') ) btn.SetDefault() hsizer.Add(btn, 1, wx.ALL, 5) sizer.Add(hsizer, 0, wx.EXPAND) self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) w = self.GetTextExtent(title)[0] + 50 if self.GetSize()[0] < w: self.SetSize((w, -1)) self.classname.Bind(wx.EVT_TEXT, self.validate)
Example #14
Source File: controlcontainer.py From admin4 with Apache License 2.0 | 5 votes |
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)
Example #15
Source File: menubar.py From wxGlade with MIT License | 5 votes |
def bind_event_handlers(self): self.Bind(wx.EVT_TEXT, self.on_label_edited, self.label) self.Bind(wx.EVT_TEXT, self.on_event_handler_edited, self.event_handler) self.Bind(wx.EVT_TEXT, self.on_name_edited, self.name) self.Bind(wx.EVT_TEXT, self.on_help_str_edited, self.help_str) self.Bind(wx.EVT_TEXT, self.on_id_edited, self.id) self.Bind(wx.EVT_RADIOBOX, self.on_type_edited, self.type) self.Bind(wx.EVT_BUTTON, self.move_item_left, self.move_left) self.Bind(wx.EVT_BUTTON, self.move_item_right, self.move_right) self.Bind(wx.EVT_BUTTON, self.move_item_up, self.move_up) self.Bind(wx.EVT_BUTTON, self.move_item_down, self.move_down) self.Bind(wx.EVT_BUTTON, self.add_item, self.add) self.Bind(wx.EVT_BUTTON, self.remove_item, self.remove) self.Bind(wx.EVT_BUTTON, self.add_separator, self.add_sep) self.Bind(wx.EVT_BUTTON, self.on_cancel, self.cancel) self.Bind(wx.EVT_BUTTON, self.on_OK, self.ok) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.show_item, self.items) self.Bind(wx.EVT_CHAR_HOOK, self.on_char) self.remove.Bind(wx.EVT_CHAR_HOOK, self.on_button_char) # to ignore the Enter key while the focus is on Remove self.items.Bind(wx.EVT_MOUSEWHEEL, lambda e: e.Skip()) # workaround to make the scroll wheel work... for c,header in enumerate(self.headers): self.items.InsertColumn(c, _(header)) self.items.SetColumnWidth(c, self.column_widths[c])
Example #16
Source File: CellEditor.py From bookhub with MIT License | 5 votes |
def __init__(self, control, possibleValues=None): self.control = control self.lastUserEnteredString = self.control.GetValue() self.control.Bind(wx.EVT_TEXT, self._OnTextEvent) if isinstance(self.control, wx.ComboBox): self.possibleValues = self.control.GetStrings() else: self.possibleValues = possibleValues or [] self.lowerCasePossibleValues = [x.lower() for x in self.possibleValues]
Example #17
Source File: params.py From admin4 with Apache License 2.0 | 5 votes |
def __init__(self, parent, name): PPanel.__init__(self, parent, name) self.ID_TEXT_CTRL = wx.NewId() self.ID_BUTTON_BROWSE = wx.NewId() sizer = wx.BoxSizer() self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(200,-1)) sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5) self.button = wx.Button(self, self.ID_BUTTON_BROWSE, 'Browse...',size=buttonSize) sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL) self.SetAutoLayout(True) self.SetSizerAndFit(sizer) self.textModified = False wx.EVT_BUTTON(self, self.ID_BUTTON_BROWSE, self.OnButtonBrowse) wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
Example #18
Source File: ConfigPanel.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def FinishSetup(self): self.shown = True if self.lines: self.AddGrid(self.lines, *self.sizerProps) spaceSizer = wx.BoxSizer(wx.HORIZONTAL) spaceSizer.Add((2, 2)) spaceSizer.Add(self.sizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 3) spaceSizer.Add((4, 4)) self.SetSizerAndFit(spaceSizer) #self.dialog.FinishSetup() def OnEvent(dummyEvent): self.SetIsDirty() self.Bind(wx.EVT_CHECKBOX, OnEvent) self.Bind(wx.EVT_BUTTON, OnEvent) self.Bind(wx.EVT_CHOICE, OnEvent) self.Bind(wx.EVT_TOGGLEBUTTON, OnEvent) self.Bind(wx.EVT_TEXT, OnEvent) self.Bind(wx.EVT_RADIOBOX, OnEvent) self.Bind(wx.EVT_RADIOBUTTON, OnEvent) self.Bind(wx.EVT_TREE_SEL_CHANGED, OnEvent) self.Bind(wx.EVT_DATE_CHANGED, OnEvent) self.Bind(eg.EVT_VALUE_CHANGED, OnEvent) self.Bind(wx.EVT_CHECKLISTBOX, OnEvent) self.Bind(wx.EVT_SCROLL, OnEvent) self.Bind(wx.EVT_LISTBOX, OnEvent)
Example #19
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, cmd=0, dat1=0, dat2=0, dat3=0, dat4=0): panel = eg.ConfigPanel() values = cmd, dat1, dat2, dat3, dat4 ctrls = [ panel.SpinIntCtrl(values[i], min=0, max=255) for i in range(5) ] hexCtrl = panel.StaticText("") def UpdateValue(event): res = ["%02X" % ctrl.GetValue() for ctrl in ctrls] hexCtrl.SetLabel(" ".join(res)) event.Skip() UpdateValue(wx.CommandEvent()) for ctrl in ctrls: ctrl.Bind(wx.EVT_TEXT, UpdateValue) panel.AddLine("CMD:", ctrls[0]) panel.AddLine( "DAT1:", ctrls[1], None, "DAT2:", ctrls[2], None, "DAT3:", ctrls[3], None, "DAT4:", ctrls[4] ) panel.AddLine() panel.AddLine("Hex string:", hexCtrl) while panel.Affirmed(): panel.SetResult(*(ctrl.GetValue() for ctrl in ctrls))
Example #20
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def Configure(self, call_id='', string=""): panel = eg.ConfigPanel() labelText = wx.StaticText(panel, -1, self.plugin.text.call_id_label) w,h=labelText.GetSize() labelDtmf = wx.StaticText(panel, -1, self.text.dtmfLabel) textControl = wx.TextCtrl(panel, -1, call_id) textControl.SetMinSize((w,-1)) textControl2 = wx.TextCtrl(panel, -1, string) textControl2.SetMinSize((w,-1)) textControl2.SetToolTip(wx.ToolTip(self.text.toolTip)) panel.sizer.Add(labelText,0,wx.TOP,10) panel.sizer.Add(textControl,0,wx.TOP,3) panel.sizer.Add(labelDtmf,0,wx.TOP,10) panel.sizer.Add(textControl2,0,wx.TOP,3) def onStringChange(evt): val = textControl2.GetValue() cur = textControl2.GetInsertionPoint() lng = len(val) tmp = [] for char in val: if char in ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","*","#"]: tmp.append(char) val = "".join(tmp) textControl2.ChangeValue(val) if len(val) < lng: PlaySound('SystemExclamation',SND_ASYNC) cur += -1 textControl2.SetInsertionPoint(cur) evt.Skip() textControl2.Bind(wx.EVT_TEXT,onStringChange) while panel.Affirmed(): panel.SetResult(textControl.GetValue(),textControl2.GetValue())
Example #21
Source File: ImageProperty.py From meerk40t with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: ImageProperty.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((276, 218)) self.spin_step_size = wx.SpinCtrl(self, wx.ID_ANY, "1", min=1, max=63) self.combo_dpi = wx.ComboBox(self, wx.ID_ANY, choices=["1000", "500", "333", "250", "200", "166", "142", "125", "111", "100"], style=wx.CB_DROPDOWN) self.text_x = wx.TextCtrl(self, wx.ID_ANY, "") self.text_y = wx.TextCtrl(self, wx.ID_ANY, "") self.text_width = wx.TextCtrl(self, wx.ID_ANY, "") self.text_height = wx.TextCtrl(self, wx.ID_ANY, "") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_SPINCTRL, self.on_spin_step, self.spin_step_size) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_step, self.spin_step_size) self.Bind(wx.EVT_COMBOBOX, self.on_combo_dpi, self.combo_dpi) self.Bind(wx.EVT_TEXT, self.on_text_x, self.text_x) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_x, self.text_x) self.Bind(wx.EVT_TEXT, self.on_text_y, self.text_y) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_y, self.text_y) self.Bind(wx.EVT_TEXT, self.on_text_width, self.text_width) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_width, self.text_width) self.Bind(wx.EVT_TEXT, self.on_text_height, self.text_height) self.Bind(wx.EVT_TEXT_ENTER, self.on_text_height, self.text_height) # end wxGlade self.image_element = None self.Bind(wx.EVT_CLOSE, self.on_close, self)
Example #22
Source File: EngraveProperty.py From meerk40t with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: EngraveProperty.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((305, 216)) self.spin_speed_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "20.0", min=0.0, max=240.0) self.spin_power_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "1000.0", min=0.0, max=1000.0) self.checkbox_custom_d_ratio = wx.CheckBox(self, wx.ID_ANY, _("Custom D-Ratio")) self.spin_speed_dratio = wx.SpinCtrlDouble(self, wx.ID_ANY, "0.261", min=0.0, max=1.0) self.checkbox_custom_accel = wx.CheckBox(self, wx.ID_ANY, _("Acceleration Override")) self.slider_accel = wx.Slider(self, wx.ID_ANY, 1, 1, 4, style=wx.SL_AUTOTICKS | wx.SL_LABELS) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_TEXT, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_TEXT, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_CHECKBOX, self.on_check_custom_d_ratio, self.checkbox_custom_d_ratio) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_TEXT, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_CHECKBOX, self.on_check_custom_accel, self.checkbox_custom_accel) self.Bind(wx.EVT_COMMAND_SCROLL, self.on_slider_accel, self.slider_accel) self.operation = None self.Bind(wx.EVT_CLOSE, self.on_close, self)
Example #23
Source File: CutProperty.py From meerk40t with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: CutProperty.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP wx.Frame.__init__(self, *args, **kwds) Module.__init__(self) self.SetSize((305, 216)) self.spin_speed_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "10.0", min=0.0, max=240.0) self.spin_power_set = wx.SpinCtrlDouble(self, wx.ID_ANY, "1000.0", min=0.0, max=1000.0) self.checkbox_custom_d_ratio = wx.CheckBox(self, wx.ID_ANY, _("Custom D-Ratio")) self.spin_speed_dratio = wx.SpinCtrlDouble(self, wx.ID_ANY, "0.261", min=0.0, max=1.0) self.checkbox_custom_accel = wx.CheckBox(self, wx.ID_ANY, _("Acceleration Override")) self.slider_accel = wx.Slider(self, wx.ID_ANY, 1, 1, 4, style=wx.SL_AUTOTICKS | wx.SL_LABELS) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_TEXT, self.on_spin_speed, self.spin_speed_set) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_TEXT, self.on_spin_power, self.spin_power_set) self.Bind(wx.EVT_CHECKBOX, self.on_check_custom_d_ratio, self.checkbox_custom_d_ratio) self.Bind(wx.EVT_SPINCTRLDOUBLE, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_TEXT_ENTER, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_TEXT, self.on_spin_speed_dratio, self.spin_speed_dratio) self.Bind(wx.EVT_CHECKBOX, self.on_check_custom_accel, self.checkbox_custom_accel) self.Bind(wx.EVT_COMMAND_SCROLL, self.on_slider_accel, self.slider_accel) self.operation = None self.Bind(wx.EVT_CLOSE, self.on_close, self)
Example #24
Source File: TextCtrlAutoComplete.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, choices=None, dropDownClick=True, element_path=None, **therest): """ Constructor works just like wx.TextCtrl except you can pass in a list of choices. You can also change the choice list at any time by calling setChoices. """ therest['style'] = wx.TE_PROCESS_ENTER | therest.get('style', 0) wx.TextCtrl.__init__(self, parent, **therest) # Some variables self._dropDownClick = dropDownClick self._lastinsertionpoint = None self._hasfocus = False self._screenheight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) self.element_path = element_path self.listbox = None self.SetChoices(choices) # gp = self # while ( gp != None ) : # gp.Bind ( wx.EVT_MOVE , self.onControlChanged, gp ) # gp.Bind ( wx.EVT_SIZE , self.onControlChanged, gp ) # gp = gp.GetParent() self.Bind(wx.EVT_KILL_FOCUS, self.OnControlChanged) self.Bind(wx.EVT_TEXT_ENTER, self.OnControlChanged) self.Bind(wx.EVT_TEXT, self.OnEnteredText) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) # If need drop down on left click if dropDownClick: self.Bind(wx.EVT_LEFT_DOWN, self.OnClickToggleDown) self.Bind(wx.EVT_LEFT_UP, self.OnClickToggleUp)
Example #25
Source File: frame_overview.py From bookhub with MIT License | 5 votes |
def InitSearchCtrls(self): """Initialize the search controls""" for (searchCtrl, olv) in [(self.SearchFile, self.myOlv)]: def _handleText(evt, searchCtrl=searchCtrl, olv=olv): self.OnTextSearchCtrl(evt, searchCtrl, olv) def _handleCancel(evt, searchCtrl=searchCtrl, olv=olv): self.OnCancelSearchCtrl(evt, searchCtrl, olv) searchCtrl.Bind(wx.EVT_TEXT, _handleText) searchCtrl.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, _handleCancel) searchCtrl.SetFocus() olv.SetFilter(Filter.TextSearch(olv, olv.columns[0:4]))
Example #26
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, id, cfg): wx.Panel.__init__(self, parent, id) self.cfg = cfg # list of names. each name is both the name of a wx.TextCtrl in # this class and the name of a string configuration variable in # cfg. self.items = [] vsizer = wx.BoxSizer(wx.VERTICAL) gsizer = wx.FlexGridSizer(4, 2, 5, 0) self.addEntry("strContinuedPageEnd", "(CONTINUED)", self, gsizer) self.addEntry("strContinuedPageStart", "CONTINUED:", self, gsizer) self.addEntry("strMore", "(MORE)", self, gsizer) self.addEntry("strDialogueContinued", " (cont'd)", self, gsizer) gsizer.AddGrowableCol(1) vsizer.Add(gsizer, 0, wx.EXPAND) self.cfg2gui() util.finishWindow(self, vsizer, center = False) for it in self.items: wx.EVT_TEXT(self, getattr(self, it).GetId(), self.OnMisc)
Example #27
Source File: spellcheckcfgdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, scDict, isGlobal): wx.Dialog.__init__(self, parent, -1, "Spell checker dictionary", style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.scDict = scDict vsizer = wx.BoxSizer(wx.VERTICAL) if isGlobal: s = "Global words:" else: s = "Script-specific words:" vsizer.Add(wx.StaticText(self, -1, s)) self.itemsEntry = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE | wx.TE_DONTWRAP, size = (300, 300)) vsizer.Add(self.itemsEntry, 1, wx.EXPAND) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add((1, 1), 1) cancelBtn = gutil.createStockButton(self, "Cancel") hsizer.Add(cancelBtn, 0, wx.LEFT, 10) okBtn = gutil.createStockButton(self, "OK") hsizer.Add(okBtn, 0, wx.LEFT, 10) vsizer.Add(hsizer, 0, wx.EXPAND | wx.TOP, 10) self.cfg2gui() util.finishWindow(self, vsizer) wx.EVT_TEXT(self, self.itemsEntry.GetId(), self.OnMisc) wx.EVT_BUTTON(self, cancelBtn.GetId(), self.OnCancel) wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
Example #28
Source File: chronolapse.py From chronolapse with MIT License | 5 votes |
def _bindUI(self, field, key, section='chronolapse'): """ Creates a two way binding for the UI element and the given section/key in the config. """ logging.debug("Binding %s[%s] to %s" % (section, key, str(field))) if hasattr(field, 'SetValue'): # if field is a checkbox, treat it differently if hasattr(field, 'IsChecked'): # on checkbox events, update the config self.Bind(wx.EVT_CHECKBOX, lambda event: self.updateConfig( {key: field.IsChecked()}, from_ui=True), field) else: # on text events, update the config self.Bind(wx.EVT_TEXT, lambda event: self.updateConfig( {key: field.GetValue()}, from_ui=True), field) # on config changes, update the UI self.config.add_listener( section, key, lambda x: field.SetValue(x)) elif hasattr(field, 'SetStringSelection'): # on Selection self.Bind(wx.EVT_COMBOBOX, lambda event: self.updateConfig( {key: field.GetStringSelection()}, from_ui=True), field) # on config changes, update the UI self.config.add_listener( section, key, lambda x: field.SetStringSelection(str(x)))
Example #29
Source File: newCust.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def __init__(self, parent, terminalObj): self.t = terminalObj wx.Dialog.__init__(self, parent, wx.ID_ANY, "Name Input", size= (650,300)) self.panel = wx.Panel(self,wx.ID_ANY) self.lblName = wx.StaticText(self.panel, label="Name", pos=(20,20)) self.name = wx.TextCtrl(self.panel, value="", pos=(110,20), size=(500,-1)) self.lblPhone = wx.StaticText(self.panel, label="Phone", pos=(20,60)) self.phone = wx.TextCtrl(self.panel, value="", pos=(110,60), size=(500,-1), validator=numOnlyValidator()) self.lblAdd = wx.StaticText(self.panel, label="Address", pos=(20,100)) self.address = wx.TextCtrl(self.panel, value="", pos=(110,100), size=(500,-1)) ''' self.lblPrevB = wx.StaticText(self.panel, label="Previous Balance\n(if any)", pos=(20,140)) self.previousBal = wx.TextCtrl(self.panel, value="", pos=(110,140), size=(500,-1), validator=numOnlyValidator()) ''' self.saveButton =wx.Button(self.panel, label="Save", pos=(110,200)) self.closeButton =wx.Button(self.panel, label="Close", pos=(250,200)) self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString) self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit) self.Bind(wx.EVT_CLOSE, self.OnQuit) self.phone.Bind(wx.EVT_TEXT, self.findInfo) self.phone.SetFocus() self.Show()
Example #30
Source File: newCust.py From HH---POS-Accounting-and-ERP-Software with MIT License | 5 votes |
def __init__(self, parent, terminalObj): self.t = terminalObj wx.Dialog.__init__(self, parent, wx.ID_ANY, "Name Input", size= (650,260)) self.panel = wx.Panel(self,wx.ID_ANY) self.lblName = wx.StaticText(self.panel, label="Name", pos=(20,20)) self.name = wx.TextCtrl(self.panel, value="", pos=(110,20), size=(500,-1)) self.lblPhone = wx.StaticText(self.panel, label="Phone", pos=(20,60)) self.phone = wx.TextCtrl(self.panel, value="", pos=(110,60), size=(500,-1), validator=numOnlyValidator()) self.lblAdd = wx.StaticText(self.panel, label="Address", pos=(20,100)) self.address = wx.TextCtrl(self.panel, value="", pos=(110,100), size=(500,-1)) ''' self.lblPrevB = wx.StaticText(self.panel, label="Previous Balance\n(if any)", pos=(20,140)) self.previousBal = wx.TextCtrl(self.panel, value="", pos=(110,140), size=(500,-1), validator=numOnlyValidator()) ''' self.saveButton =wx.Button(self.panel, label="Save", pos=(110,200)) self.closeButton =wx.Button(self.panel, label="Close", pos=(250,200)) self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString) self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit) self.Bind(wx.EVT_CLOSE, self.OnQuit) self.phone.Bind(wx.EVT_TEXT, self.findInfo) self.phone.SetFocus() self.Show()