当前位置: 首页>>代码示例>>Python>>正文


Python tkinter.INSERT属性代码示例

本文整理汇总了Python中tkinter.INSERT属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.INSERT属性的具体用法?Python tkinter.INSERT怎么用?Python tkinter.INSERT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在tkinter的用法示例。


在下文中一共展示了tkinter.INSERT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
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 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:18,代码来源:Editor.py

示例2: find

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
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 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:25,代码来源:Find.py

示例3: select_all

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
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" 
开发者ID:nimaid,项目名称:LPHK,代码行数:7,代码来源:window.py

示例4: import_script

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
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) 
开发者ID:nimaid,项目名称:LPHK,代码行数:12,代码来源:window.py

示例5: update_index

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def update_index(event=None):
    cursor_position = text.index(tk.INSERT)
    cursor_position_pieces = str(cursor_position).split('.')

    cursor_line = cursor_position_pieces[0]
    cursor_char = cursor_position_pieces[1]

    current_index.set('line: ' + cursor_line + ' char: ' + cursor_char + ' index: ' + str(cursor_position)) 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:10,代码来源:indexing.py

示例6: highlight_line

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def highlight_line(event=None):
    start = str(text.index(tk.INSERT)) + " linestart"
    end = str(text.index(tk.INSERT)) + " lineend"
    text.tag_add("sel", start, end)

    return "break" 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:8,代码来源:indexing2.py

示例7: highlight_word

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def highlight_word(event=None):
    word_pos = str(text.index(tk.INSERT))
    start = word_pos + " wordstart"
    end = word_pos + " wordend"
    text.tag_add("sel", start, end)

    return "break" 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:9,代码来源:indexing2.py

示例8: down_three_lines

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def down_three_lines(event=None):
    current_cursor_index = str(text.index(tk.INSERT))
    new_position = current_cursor_index + "+3l"
    text.mark_set(tk.INSERT, new_position)

    return "break" 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:8,代码来源:indexing2.py

示例9: back_four_chars

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def back_four_chars(event=None):
    current_cursor_index = str(text.index(tk.INSERT))
    new_position = current_cursor_index + "-4c"
    text.mark_set(tk.INSERT, new_position)

    return "break" 
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Programming-by-Example,代码行数:8,代码来源:searching.py

示例10: set_signed_in

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def set_signed_in(self, me):
        """
        Configures the application as "signed in" (displays user's
        name and disables the entry to input phone/bot token/code).
        """
        self.me = me
        self.sign_in_label.configure(text='Signed in')
        self.sign_in_entry.configure(state=tkinter.NORMAL)
        self.sign_in_entry.delete(0, tkinter.END)
        self.sign_in_entry.insert(tkinter.INSERT, utils.get_display_name(me))
        self.sign_in_entry.configure(state=tkinter.DISABLED)
        self.sign_in_button.configure(text='Log out')
        self.chat.focus()

    # noinspection PyUnusedLocal 
开发者ID:LonamiWebs,项目名称:Telethon,代码行数:17,代码来源:gui.py

示例11: on_moved

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def on_moved(self, event=None):
        state = tk.NORMAL if not self.editor.is_empty() else tk.DISABLED
        self.editMenu.entryconfigure(FIND + ELLIPSIS, state=state)
        self.findButton.config(state=state)
        lineCol = self.editor.index(tk.INSERT).split(".")
        self.positionLabel.config(text="↓{}→{}".format(lineCol[0],
                lineCol[1])) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:9,代码来源:Main.py

示例12: check

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def check():
            textEdit.frame.config(borderwidth=2)
            print("frame", textEdit.frame.cget("borderwidth"))
            print("yscrollbar", textEdit.yscrollbar.fraction(5, 5))
            textEdit.insert("end",
                "This is a test of the method delegation.\n" * 20)
            print("text", textEdit.text.index(tk.INSERT))
            print("text", textEdit.index(tk.INSERT)) 
开发者ID:lovexiaov,项目名称:python-in-practice,代码行数:10,代码来源:TextEdit.py

示例13: use_queues

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def use_queues(self, loops=5):
        # Now using a class member Queue        
        while True: 
            q_item = self.gui_queue.get()
            print(q_item)
            self.scrol.insert(tk.INSERT, q_item + '\n') 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:8,代码来源:GUI_URL.py

示例14: method_in_a_thread

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def method_in_a_thread(self, num_of_loops=10):
        for idx in range(num_of_loops):
            sleep(1)
            self.scrol.insert(tk.INSERT, str(idx) + '\n')  

    # Running methods in Threads 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:8,代码来源:GUI_URL.py

示例15: click_me

# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import INSERT [as 别名]
def click_me(self): 
        self.action.configure(text='Hello ' + self.name.get())
        bq.write_to_scrol(self)       
        sleep(2)
        html_data = url.get_html()
        print(html_data)
        self.scrol.insert(tk.INSERT, html_data)
            
    # Spinbox callback 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:11,代码来源:GUI_URL.py


注:本文中的tkinter.INSERT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。