Python tkinter.END Examples
The following are 30
code examples of tkinter.END().
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
tkinter
, or try the search function
.

Example #1
Source File: textarea.py From Tkinter-GUI-Programming-by-Example with MIT License | 7 votes |
def find(self, text_to_find): length = tk.IntVar() idx = self.search(text_to_find, self.find_search_starting_index, stopindex=tk.END, count=length) if idx: self.tag_remove('find_match', 1.0, tk.END) end = f'{idx}+{length.get()}c' self.tag_add('find_match', idx, end) self.see(idx) self.find_search_starting_index = end self.find_match_index = idx else: if self.find_match_index != 1.0: if msg.askyesno("No more results", "No further matches. Repeat from the beginning?"): self.find_search_starting_index = 1.0 self.find_match_index = None return self.find(text_to_find) else: msg.showinfo("No Matches", "No matching text found")
Example #2
Source File: labelSettingsFrame.py From PyEveLiveDPS with GNU General Public License v3.0 | 7 votes |
def __init__(self, parent=None, title="", decimalPlaces=0, inThousands=0, *args, **kwargs): tk.Frame.__init__(self, parent, *args, **kwargs) gridFrame = self._nametowidget(parent.winfo_parent()) self.parent = self._nametowidget(gridFrame.winfo_parent()) self.grid(row="0", column="0", sticky="ew") self.columnconfigure(0,weight=1) self.singleLabel = singleLabel = tk.Label(self, text=title) singleLabel.grid(row="0",column="0", sticky="ew") self.listbox = listbox = tk.Spinbox(self, from_=0, to=9, width=1, borderwidth=1, highlightthickness=0) listbox.delete(0,tk.END) listbox.insert(0,decimalPlaces) listbox.grid(row="0", column="1") checkboxValue = tk.IntVar() checkboxValue.set(inThousands) self.checkbox = checkbox = tk.Checkbutton(self, text="K", variable=checkboxValue, borderwidth=0, highlightthickness=0) checkbox.var = checkboxValue checkbox.grid(row="0", column="2") singleLabel.bind("<Button-1>", lambda e:self.dragStart(e, listbox, checkbox))
Example #3
Source File: window.py From LPHK with GNU General Public License v3.0 | 6 votes |
def select_all(self, event): event.widget.tag_add(tk.SEL, "1.0", tk.END) event.widget.mark_set(tk.INSERT, "1.0") event.widget.see(tk.INSERT) return "break"
Example #4
Source File: chatwindow.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def receive_message(self, message, smilies): """ Writes message into messages_area :param message: message text :param smilies: list of tuples of (char_index, smilie_file), where char_index is the x index of the smilie's location and smilie_file is the file name only (no path) :return: None """ self.messages_area.configure(state='normal') self.messages_area.insert(tk.END, message) if len(smilies): last_line_no = self.messages_area.index(tk.END) last_line_no = str(last_line_no).split('.')[0] last_line_no = str(int(last_line_no) - 2) for index, file in smilies: smilie_path = os.path.join(SmilieSelect.smilies_dir, file) image = tk.PhotoImage(file=smilie_path) smilie_index = last_line_no + '.' + index self.messages_area.image_create(smilie_index, image=image) self.messages_area.configure(state='disabled')
Example #5
Source File: textarea.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def find(self, text_to_find): length = tk.IntVar() idx = self.search(text_to_find, self.find_search_starting_index, stopindex=tk.END, count=length) if idx: self.tag_remove('find_match', 1.0, tk.END) end = f'{idx}+{length.get()}c' self.tag_add('find_match', idx, end) self.see(idx) self.find_search_starting_index = end self.find_match_index = idx else: if self.find_match_index != 1.0: if msg.askyesno("No more results", "No further matches. Repeat from the beginning?"): self.find_search_starting_index = 1.0 self.find_match_index = None return self.find(text_to_find) else: msg.showinfo("No Matches", "No matching text found")
Example #6
Source File: textarea.py From Tkinter-GUI-Programming-by-Example with MIT License | 6 votes |
def find(self, text_to_find): length = tk.IntVar() idx = self.search(text_to_find, self.find_search_starting_index, stopindex=tk.END, count=length) if idx: self.tag_remove('find_match', 1.0, tk.END) end = f'{idx}+{length.get()}c' self.tag_add('find_match', idx, end) self.see(idx) self.find_search_starting_index = end self.find_match_index = idx else: if self.find_match_index != 1.0: if msg.askyesno("No more results", "No further matches. Repeat from the beginning?"): self.find_search_starting_index = 1.0 self.find_match_index = None return self.find(text_to_find) else: msg.showinfo("No Matches", "No matching text found")
Example #7
Source File: viewer.py From networkx_viewer with GNU General Public License v3.0 | 6 votes |
def goto_path(self, event): frm = self.node_entry.get() to = self.node_entry2.get() self.node_entry.delete(0, tk.END) self.node_entry2.delete(0, tk.END) if frm == '': tkm.showerror("No From Node", "Please enter a node in both " "boxes to plot a path. Enter a node in only the first box " "to bring up nodes immediately adjacent.") return if frm.isdigit() and int(frm) in self.canvas.dataG.nodes(): frm = int(frm) if to.isdigit() and int(to) in self.canvas.dataG.nodes(): to = int(to) self.canvas.plot_path(frm, to, levels=self.level)
Example #8
Source File: map-creator.py From rpg-text with MIT License | 6 votes |
def load(self, x, y): name = "" for key, val in self.master.data.data.items(): if val.get('position') == [x, y]: name = key break if self.master.data.data[name] != {}: self.form_entries['Description'].delete('1.0', tk.END) self.form_entries["Description"].insert(tk.END, self.master.data.data[name]['description']) self.variables["Icon"].set(self.master.data.data[name]['map_icon']) self.variables["Location Name"].set(name) self.variables["NPCs"].set(" ".join(self.master.data.data[name]['npc'])) for e, en in zip(self.exits_var, self.exits_names): e.set(1 if en in self.master.data.data[name]['exits'] else 0) else: self.form_entries['Description'].delete('1.0', tk.END) self.variables["Icon"].set("") self.variables["Location Name"].set("") self.variables["NPCs"].set("") for e in self.exits_var: e.set(0)
Example #9
Source File: pynpuzzle.py From pynpuzzle with MIT License | 6 votes |
def spinbox_command(action): """ n input spinbox up and down handler. """ value = int(math.sqrt(int(n_spinbox.get()) + 1)) # If up button clicked if action == 'up': value += 1 # If down button clicked else: if value == 3: return value -= 1 value = value * value - 1 n_spinbox.delete(0, tkinter.END) n_spinbox.insert(0, value) change_app_n(value) # n spinbox
Example #10
Source File: settings.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def on_moved(self, event): if not event.dest_path.endswith('.json'): return try: currentProfileName = self.allSettings[self.selectedIndex.get()]["profile"] except AttributeError: return settingsFile = open(self.fullPath, 'r') self.allSettings = json.load(settingsFile) settingsFile.close() self.mainWindow.profileMenu.delete(0,tk.END) self.initializeMenu(self.mainWindow) i = 0 for profile in self.allSettings: if (profile["profile"] == currentProfileName): self.currentProfile = profile["profileSettings"] self.selectedIndex.set(i) self.mainWindow.event_generate('<<ChangeSettings>>') return i += 1 self.currentProfile = self.allSettings[0]["profileSettings"] self.selectedIndex.set(0) self.mainWindow.event_generate('<<ChangeSettings>>')
Example #11
Source File: settings.py From PyEveLiveDPS with GNU General Public License v3.0 | 6 votes |
def addProfile(self, add=False, duplicate=False, rename=False): if (self.profileString.get() == "Default"): tk.messagebox.showerror("Error", "There can only be one profile named 'Default'") return for profile in self.allSettings: if self.profileString.get() == profile["profile"]: tk.messagebox.showerror("Error", "There is already a profile named '" + self.profileString.get() + "'") return if add: newProfile = copy.deepcopy(self.defaultProfile[0]) newProfile["profile"] = self.profileString.get() self.allSettings.insert(0, newProfile) elif duplicate: newProfile = copy.deepcopy(self.allSettings[self.selectedIndex.get()]) newProfile["profile"] = self.profileString.get() self.allSettings.insert(0, newProfile) elif rename: self.allSettings[self.selectedIndex.get()]["profile"] = self.profileString.get() self.allSettings.insert(0, self.allSettings.pop(self.selectedIndex.get())) self.mainWindow.profileMenu.delete(0,tk.END) self.initializeMenu(self.mainWindow) self.switchProfile() self.newProfileWindow.destroy()
Example #12
Source File: demo.py From OpenCV-Python-Tutorial with MIT License | 6 votes |
def on_demo_select(self, evt): name = self.demos_lb.get( self.demos_lb.curselection()[0] ) fn = self.samples[name] loc = {} if PY3: exec(open(fn).read(), loc) else: execfile(fn, loc) descr = loc.get('__doc__', 'no-description') self.linker.reset() self.text.config(state='normal') self.text.delete(1.0, tk.END) self.format_text(descr) self.text.config(state='disabled') self.cmd_entry.delete(0, tk.END) self.cmd_entry.insert(0, fn)
Example #13
Source File: About.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def populate_text(self): self.text.insert(tk.END, "{}\n".format(APPNAME), ("title", "center")) self.text.insert(tk.END, "Copyright © 2012-13 Qtrac Ltd. " "All rights reserved.\n", ("center",)) self.text.insert(tk.END, "www.qtrac.eu/pipbook.html\n", ("center", "url", "above5")) self.add_lines(""" This program or module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is provided for educational purposes and is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.""") self.text.insert(tk.END, "\n" + TkUtil.about(self.master, APPNAME, VERSION), ("versions", "center", "above3"))
Example #14
Source File: Editor.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def load(self, filename): self.delete("1.0", tk.END) try: with open(filename, "r", encoding="utf-8") as file: self.insert("1.0", file.read()) except EnvironmentError as err: self.set_status_text("Failed to load {}".format(filename)) return False self.mark_set(tk.INSERT, "1.0") self.edit_modified(False) self.edit_reset() self.master.title("{} \u2014 {}".format(os.path.basename(filename), APPNAME)) self.filename = filename self.set_status_text("Loaded {}".format(filename)) return True
Example #15
Source File: Find.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def find(self, event=None): text = self.findEntry.get() assert text length = len(text) caseInsensitive = not self.caseSensitive.get() wholeWords = self.wholeWords.get() if wholeWords: text = r"\m{}\M".format(re.escape(text)) # Tcl regex syntax self.editor.tag_remove(FIND_TAG, "1.0", tk.END) insert = self.editor.index(tk.INSERT) start = self.editor.search(text, insert, nocase=caseInsensitive, regexp=wholeWords) if start and start == insert: start = self.editor.search(text, "{} +{} char".format( insert, length), nocase=caseInsensitive, regexp=wholeWords) if start: self.editor.mark_set(tk.INSERT, start) self.editor.see(start) end = "{} +{} char".format(start, length) self.editor.tag_add(FIND_TAG, start, end) return start, end return None, None
Example #16
Source File: About.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def populate_text(self): self.text.insert(tk.END, "{}\n".format(APPNAME), ("title", "center")) self.text.insert(tk.END, "Copyright © 2012-13 Qtrac Ltd. " "All rights reserved.\n", ("center",)) self.text.insert(tk.END, "www.qtrac.eu/pipbook.html\n", ("center", "url", "above5")) self.add_lines(""" This program or module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is provided for educational purposes and is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.""") self.add_lines(""" {} was inspired by tile fall/same game which was originally written for the Amiga and Psion by Adam Dawes.""".format(APPNAME)) self.text.insert(tk.END, "\n" + TkUtil.about(self.master, APPNAME, VERSION), ("versions", "center", "above3"))
Example #17
Source File: About.py From python-in-practice with GNU General Public License v3.0 | 6 votes |
def populate_text(self): self.text.insert(tk.END, "{}\n".format(APPNAME), ("title", "center")) self.text.insert(tk.END, "Copyright © 2012-13 Qtrac Ltd. " "All rights reserved.\n", ("center",)) self.text.insert(tk.END, "www.qtrac.eu/pipbook.html\n", ("center", "url", "above5")) self.add_lines(""" This program or module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is provided for educational purposes and is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.""") self.text.insert(tk.END, "\n" + TkUtil.about(self.master, APPNAME, VERSION), ("versions", "center", "above3"))
Example #18
Source File: window.py From LPHK with GNU General Public License v3.0 | 5 votes |
def import_script(self, textbox, window): name = tk.filedialog.askopenfilename(parent=window, initialdir=files.SCRIPT_PATH, title="Import script", filetypes=load_script_filetypes) if name: text = files.import_script(name) text = files.strip_lines(text) textbox.delete("1.0", tk.END) textbox.insert(tk.INSERT, text)
Example #19
Source File: window.py From LPHK with GNU General Public License v3.0 | 5 votes |
def export_script(self, textbox, window): name = tk.filedialog.asksaveasfilename(parent=window, initialdir=files.SCRIPT_PATH, title="Export script", filetypes=save_script_filetypes) if name: if files.SCRIPT_EXT not in name: name += files.SCRIPT_EXT text = textbox.get("1.0", tk.END) text = files.strip_lines(text) files.export_script(name, text)
Example #20
Source File: wicc_view_wordlist.py From WiCC with GNU General Public License v3.0 | 5 votes |
def reset_list(self): """ Deletes all elements in the words array and Listobx :author: Pablo Sanz Alguacil """ self.words = [] self.listbox_words.delete(0, END)
Example #21
Source File: textarea.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def select_all(self, event=None): self.tag_add("sel", 1.0, tk.END) return "break"
Example #22
Source File: textarea.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def cancel_find(self): self.find_search_starting_index = 1.0 self.find_match_index = None self.tag_remove('find_match', 1.0, tk.END)
Example #23
Source File: searching.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def tag_python(event=None): text.tag_configure('python', foreground="green") start = 1.0 idx = text.search('python', start, stopindex=tk.END) while idx: tag_begin = idx tag_end = f"{idx}+6c" text.tag_add('python', tag_begin, tag_end) start = tag_end idx = text.search('python', start, stopindex=tk.END) return "break"
Example #24
Source File: linenumbers.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def on_key_press(self, event=None): final_index = str(self.text_widget.index(tk.END)) num_of_lines = final_index.split('.')[0] line_numbers_string = "\n".join(str(no + 1) for no in range(int(num_of_lines))) width = len(str(num_of_lines)) self.configure(state='normal', width=width) self.delete(1.0, tk.END) self.insert(1.0, line_numbers_string) self.configure(state='disabled')
Example #25
Source File: highlighter.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def highlight_regex(self, regex, tag): length = tk.IntVar() start = 1.0 idx = self.text_widget.search(regex, start, stopindex=tk.END, regexp=1, count=length) while idx: end = f"{idx}+{length.get()}c" self.text_widget.tag_add(tag, idx, end) start = end idx = self.text_widget.search(regex, start, stopindex=tk.END, regexp=1, count=length)
Example #26
Source File: chatwindow.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def send_message(self, event=None): message = self.text_area.get(1.0, tk.END) if message.strip() or len(self.text_area.smilies): self.master.requester.send_message( self.master.username, self.friend_username, message, ) message = "Me: " + message self.messages_area.configure(state='normal') self.messages_area.insert(tk.END, message) if len(self.text_area.smilies): last_line_no = self.messages_area.index(tk.END) last_line_no = str(last_line_no).split('.')[0] last_line_no = str(int(last_line_no) - 2) for index, file in self.text_area.smilies: char_index = str(index).split('.')[1] char_index = str(int(char_index) + 4) smilile_index = last_line_no + '.' + char_index self.messages_area.image_create(smilile_index, image=file) self.text_area.smilies = [] self.messages_area.configure(state='disabled') self.text_area.delete(1.0, tk.END) return "break"
Example #27
Source File: chatwindow.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def add_smilie(self, smilie): smilie_index = self.text_area.index(self.text_area.image_create(tk.END, image=smilie)) self.text_area.smilies.append((smilie_index, smilie))
Example #28
Source File: chatwindow.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def receive_message(self, author, message): self.messages_area.configure(state='normal') if author == self.master.username: author = "Me" message_with_author = author + ": " + message self.messages_area.insert(tk.END, message_with_author) self.messages_area.configure(state='disabled')
Example #29
Source File: chatwindow.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def send_message(self, event=None): message = self.text_area.get(1.0, tk.END) if message.strip() or len(self.text_area.smilies): message = "Me: " + message self.messages_area.configure(state='normal') self.messages_area.insert(tk.END, message) if len(self.text_area.smilies): last_line_no = self.messages_area.index(tk.END) last_line_no = str(last_line_no).split('.')[0] last_line_no = str(int(last_line_no) - 2) for index, file in self.text_area.smilies: char_index = str(index).split('.')[1] char_index = str(int(char_index) + 4) smilile_index = last_line_no + '.' + char_index self.messages_area.image_create(smilile_index, image=file) self.text_area.smilies = [] self.messages_area.configure(state='disabled') self.text_area.delete(1.0, tk.END) return "break"
Example #30
Source File: textarea.py From Tkinter-GUI-Programming-by-Example with MIT License | 5 votes |
def select_all(self, event=None): self.tag_add("sel", 1.0, tk.END) return "break"