def __init__(self, master=None): Observable.__init__(self) hashText = StringVar() hashText.trace("w", lambda nm, idx, mode, var=hashText: self.textChanged(hashText)) Entry.__init__(self, master, textvariable = hashText)
def __init__(self, autocompleteList, *args, **kwargs): # Listbox length self.listboxLength = kwargs.pop('listboxLength', 12) self.listboxFontSize = tkFont.Font(size=18) # Custom matches function if 'matchesFunction' in kwargs: self.matchesFunction = kwargs['matchesFunction'] del kwargs['matchesFunction'] else: def matches(fieldValue, acListEntry): pattern = re.compile('.*' + re.escape(fieldValue) + '.*', re.IGNORECASE) return re.match(pattern, acListEntry) self.matchesFunction = matches Entry.__init__(self, *args, **kwargs) self.focus() self.autocompleteList = autocompleteList self.var = self["textvariable"] if self.var == '': self.var = self["textvariable"] = StringVar() self.var.trace('w', self.changed) self.bind("<Return>", self.selection) self.bind("<Up>", self.moveUp) self.bind("<Down>", self.moveDown) self.listboxUp = False
def __init__(self, parent, text_variable=None, constraints=None, **kw): self._var = text_variable or StringVar() self._constraints = constraints or Constraints() self._var.set(1) self.refresh_input() Entry.__init__(self, parent, textvariable=self._var, width=10, **kw) self.bind("<FocusOut>", lambda event: self.refresh_input())
def __init__(self, master, x, y, text): Entry.__init__(self, master = master) self.text = StringVar() self.text.set(text) self.config(relief = 'ridge', justify = 'center', width = DEFAULT_WIDTH, textvariable = self.text, state = 'readonly') self.grid(column = x, row = y)
def __init__(self, root, printer, settings, log, *arg): Entry.__init__(self, root, *arg, state="readonly", takefocus="0") self.app = root self.printer = printer self.settings = settings self.log = log self.afterID = None self.iCycle = 0 self.m117cycle = 0 self.statusChecker()
def __init__(self, master, x, y, text): Entry.__init__(self, master=master) self.text = StringVar() self.text.set(text) self.config(relief='ridge', justify='center', width=DEFAULT_WIDTH, textvariable=self.text, state='readonly') self.grid(column=x, row=y)
def __init__(self, parent, text, relx, rely): self.parent = parent self.text = text self.relx = relx self.rely = rely Entry.__init__(self, self.parent) self.entry_configure_() self.entry_place_() self.label_rely = self.rely - 0.050 self.label_create_()
def __init__(self, *args, **kwargs): self.guis = [] ui = kwargs.pop("ui", None) if ui: self.guis += [(ui, kwargs.pop("pos", None), kwargs.pop("m", None))] Entry.__init__(self, *args, **kwargs) sv = StringVar() sv.trace("w", lambda name, index, mode, sv=sv: self.char_callback(sv)) self["textvariable"] = sv self.bind("<FocusIn>", self.focusCase) self.bind("<FocusOut>", self.unfocusCase)
def __init__(self, *args, **kwargs): self.guis = [] ui = kwargs.pop('ui', None) if ui: self.guis += [(ui, kwargs.pop('pos', None), kwargs.pop('m', None))] Entry.__init__(self, *args, **kwargs) sv = StringVar() sv.trace("w", lambda name, index, mode, sv=sv: self.char_callback(sv)) self['textvariable'] = sv self.bind("<FocusIn>", self.focusCase) self.bind("<FocusOut>", self.unfocusCase)
def __init__(self, parent, **kwargs): """! A constructor for the class @param self The pointer for the object @param parent The parent object for the frame @param **kwargs Other arguments as accepted by ttk.Entry """ #Initialise the inherited class tkEntry.__init__(self, parent) #Apply formatting self.config(relief="ridge", bg=DEFAULT_BACKGROUND, fg=TABLE_HEADER_TEXT_COLOUR, readonlybackground=DEFAULT_BACKGROUND, justify='center', width=8, state="readonly")
def __init__(self, *args, **kwargs): Entry.__init__(self, width=100, *args, **kwargs) self.focus_set() self.pack() self.var = self["textvariable"] if self.var == '': self.var = self["textvariable"] = StringVar() self.var.trace('w', self.changed) self.bind("<Right>", self.selection) self.bind("<Up>", self.up) self.bind("<Down>", self.down) self.bind("<Return>", self.enter) self.lb_up = False self.lb = None
def __init__(self, master, **kwargs): self.values = [] edict = {} init = "" for k in kwargs.keys(): if not k in ('Return', 'values', 'init', 'command', 'wrap'): edict[k] = kwargs[k] # edict['validate']='key' # okaycmd=self.register(self.isOkay) # edict['validatecommand']=(okaycmd, '%S') Entry.__init__(self, master, **edict) if kwargs.has_key('Return'): self.bind('<Return>', kwargs['Return']) else: self.bind('<Return>', self.Search) self.wrap = False if kwargs.has_key('values'): self.values = kwargs['values'] if kwargs.has_key('init'): init = kwargs['init'] if kwargs.has_key('command'): self.CommandCallBack = kwargs['command'] if kwargs.has_key('wrap'): self.wrap = True if self.values: self.Index = 0 if init and init in self.values: self.Index = self.values.index(init) self.insert(0, self.values[self.Index]) self.bind('<MouseWheel>', self.MouseWheelEvent) self.bind('<Up>', self.FlipUp) self.bind('<Down>', self.FlipDn)
def __init__(self, parent): Entry.__init__(self, parent)
def __init__(self, master, list_of_items=None, autocomplete_function=None, listbox_width=None, listbox_height=7, ignorecase_match=False, startswith_match=True, vscrollbar=True, hscrollbar=True, **kwargs): if hasattr(self, "autocomplete_function"): if autocomplete_function is not None: raise ValueError( "Combobox_Autocomplete subclass has 'autocomplete_function' implemented" ) else: if autocomplete_function is not None: self.autocomplete_function = autocomplete_function else: if list_of_items is None: raise ValueError( "If not guiven complete function, list_of_items can't be 'None'" ) if ignorecase_match: if startswith_match: def matches_function(entry_data, item): return item.startswith(entry_data) else: def matches_function(entry_data, item): return item in entry_data self.autocomplete_function = lambda entry_data: [ item for item in self.list_of_items if matches_function(entry_data, item) ] else: if startswith_match: def matches_function(escaped_entry_data, item): if re.match(escaped_entry_data, item, re.IGNORECASE): return True else: return False else: def matches_function(escaped_entry_data, item): if re.search(escaped_entry_data, item, re.IGNORECASE): return True else: return False def autocomplete_function(entry_data): escaped_entry_data = re.escape(entry_data) return [ item for item in self.list_of_items if matches_function(escaped_entry_data, item) ] self.autocomplete_function = autocomplete_function self._listbox_height = int(listbox_height) self._listbox_width = listbox_width self.list_of_items = list_of_items self._use_vscrollbar = vscrollbar self._use_hscrollbar = hscrollbar kwargs.setdefault("background", "white") if "textvariable" in kwargs: self._entry_var = kwargs["textvariable"] else: self._entry_var = kwargs["textvariable"] = StringVar() Entry.__init__(self, master, **kwargs) self._trace_id = self._entry_var.trace('w', self._on_change_entry_var) self._listbox = None self.bind("<Tab>", self._on_tab) self.bind("<Up>", self._previous) self.bind("<Down>", self._next) self.bind('<Control-n>', self._next) self.bind('<Control-p>', self._previous) self.bind("<Return>", self._update_entry_from_listbox) self.bind("<Escape>", lambda event: self.unpost_listbox())
def __init__(self, master, list_of_items=None, autocomplete_function=None, listbox_width=None, listbox_height=7, ignorecase_match=False, startswith_match=True, vscrollbar=True, hscrollbar=True, **kwargs): if hasattr(self, "autocomplete_function"): if autocomplete_function is not None: raise ValueError("Combobox_Autocomplete subclass has 'autocomplete_function' implemented") else: if autocomplete_function is not None: self.autocomplete_function = autocomplete_function else: if list_of_items is None: raise ValueError("If not guiven complete function, list_of_items can't be 'None'") if ignorecase_match: if startswith_match: def matches_function(entry_data, item): return item.startswith(entry_data) else: def matches_function(entry_data, item): return item in entry_data self.autocomplete_function = lambda entry_data: [item for item in self.list_of_items if matches_function(entry_data, item)] else: if startswith_match: def matches_function(escaped_entry_data, item): if re.match(escaped_entry_data, item, re.IGNORECASE): return True else: return False else: def matches_function(escaped_entry_data, item): if re.search(escaped_entry_data, item, re.IGNORECASE): return True else: return False def autocomplete_function(entry_data): escaped_entry_data = re.escape(entry_data) return [item for item in self.list_of_items if matches_function(escaped_entry_data, item)] self.autocomplete_function = autocomplete_function self._listbox_height = int(listbox_height) self._listbox_width = listbox_width self.list_of_items = list_of_items self._use_vscrollbar = vscrollbar self._use_hscrollbar = hscrollbar kwargs.setdefault("background", "white") if "textvariable" in kwargs: self._entry_var = kwargs["textvariable"] else: self._entry_var = kwargs["textvariable"] = StringVar() Entry.__init__(self, master, **kwargs) self._trace_id = self._entry_var.trace('w', self._on_change_entry_var) self._listbox = None self.bind("<Tab>", self._on_tab) self.bind("<Up>", self._previous) self.bind("<Down>", self._next) self.bind('<Control-n>', self._next) self.bind('<Control-p>', self._previous) self.bind("<Return>", self._update_entry_from_listbox) self.bind("<Escape>", lambda event: self.unpost_listbox())
def __init__( self, parent, type, type_class, **kw): Entry.__init__( self, parent, kw) self.arrow = None self.type_class = type_class # is one of ("internal", "reference") self.type = type
def __init__(self, parent, type, type_class, **kw): Entry.__init__(self, parent, kw) self.arrow = None self.type_class = type_class # is one of ("internal", "reference") self.type = type