當前位置: 首頁>>代碼示例>>Python>>正文


Python tkinter.SEL屬性代碼示例

本文整理匯總了Python中tkinter.SEL屬性的典型用法代碼示例。如果您正苦於以下問題:Python tkinter.SEL屬性的具體用法?Python tkinter.SEL怎麽用?Python tkinter.SEL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在tkinter的用法示例。


在下文中一共展示了tkinter.SEL屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: select_all

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [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

示例2: on_selection

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def on_selection(self, event=None):
        state = (tk.NORMAL if self.editor.text.tag_ranges(tk.SEL)
                 else tk.DISABLED)
        self.editMenu.entryconfigure(COPY, state=state)
        self.copyButton.config(state=state)
        self.editMenu.entryconfigure(CUT, state=state)
        self.cutButton.config(state=state) 
開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:9,代碼來源:Main.py

示例3: context_menu

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def context_menu(self, event):
        modifier = TkUtil.menu_modifier()
        menu = tk.Menu(self.master)
        if self.editor.text.tag_ranges(tk.SEL):
            menu.add_command(label=COPY, underline=0,
                    command=lambda: self.editor.text.event_generate(
                        "<<Copy>>"), image=self.menuImages[COPY],
                    compound=tk.LEFT, accelerator=modifier + "+C")
            menu.add_command(label=CUT, underline=2,
                    command=lambda: self.editor.text.event_generate(
                        "<<Cut>>"), image=self.menuImages[CUT],
                    compound=tk.LEFT, accelerator=modifier + "+X")
        menu.add_command(label=PASTE, underline=0,
                command=lambda: self.editor.text.event_generate(
                    "<<Paste>>"), image=self.menuImages[PASTE],
                compound=tk.LEFT, accelerator=modifier + "+V")
        menu.add_separator()
        menu.add_checkbutton(label=BOLD, underline=0,
                image=self.menuImages[BOLD], compound=tk.LEFT,
                variable=self.bold,
                command=lambda: self.toggle_button(self.boldButton))
        menu.add_checkbutton(label=ITALIC, underline=0,
                image=self.menuImages[ITALIC], compound=tk.LEFT,
                variable=self.italic,
                command=lambda: self.toggle_button(self.italicButton))
        menu.add_separator()
        menu.add_radiobutton(label=ALIGN_LEFT, underline=6,
                image=self.menuImages[ALIGNLEFT], compound=tk.LEFT,
                variable=self.alignment, value=tk.LEFT,
                command=self.toggle_alignment)
        menu.add_radiobutton(label=ALIGN_CENTER, underline=6,
                image=self.menuImages[ALIGNCENTER],
                compound=tk.LEFT, variable=self.alignment, value=tk.CENTER,
                command=self.toggle_alignment)
        menu.add_radiobutton(label=ALIGN_RIGHT, underline=6,
                image=self.menuImages[ALIGNRIGHT],
                compound=tk.LEFT, variable=self.alignment, value=tk.RIGHT,
                command=self.toggle_alignment)
        menu.tk_popup(event.x_root, event.y_root) 
開發者ID:lovexiaov,項目名稱:python-in-practice,代碼行數:41,代碼來源:Main.py

示例4: select_all

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def select_all(self, event):
        ''' Selects all data in the text widget. This event is
            called when user presses Control-Key-a or Control-Key-A.

            Returns:
                str: string break.
        '''
        self.text.tag_add(SEL, '1.0', END)
        self.text.mark_set(INSERT, '1.0')
        self.text.see(INSERT)
        return 'break' 
開發者ID:araith,項目名稱:pyDEA,代碼行數:13,代碼來源:text_frame_gui.py

示例5: select_all

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def select_all(self, event):
        self.out_text.tag_add(tk.SEL, "1.0", tk.END)
        self.out_text.mark_set(tk.INSERT, "1.0")
        self.out_text.see(tk.INSERT)
        return 'break' 
開發者ID:giswqs,項目名稱:WhiteboxTools-ArcGIS,代碼行數:7,代碼來源:wb_runner.py

示例6: copy_text

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def copy_text(self):
        selection = self.text.tag_ranges(tk.SEL)
        if selection:
            self.clipboard_clear()
            self.clipboard_append(self.text.get(*selection)) 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Application-Development-Cookbook,代碼行數:7,代碼來源:chapter4_07.py

示例7: delete_text

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def delete_text(self):
        selection = self.text.tag_ranges(tk.SEL)
        if selection:
            self.text.delete(*selection) 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Application-Development-Cookbook,代碼行數:6,代碼來源:chapter4_07.py

示例8: enable_selection

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def enable_selection(self):
         state_selection = tk.ACTIVE if self.text.tag_ranges(tk.SEL) else tk.DISABLED
         state_clipboard = tk.ACTIVE
		 
         try:
             self.clipboard_get()
         except tk.TclError:
             state_clipboard = tk.DISABLED
			 
         self.menu.entryconfig(0, state=state_selection) # Cut
         self.menu.entryconfig(1, state=state_selection) # Copy
         self.menu.entryconfig(2, state=state_clipboard) # Paste
         self.menu.entryconfig(3, state=state_selection) # Delete 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Application-Development-Cookbook,代碼行數:15,代碼來源:chapter4_07_disabled.py

示例9: add_hyperlink

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def add_hyperlink(self):
        selection = self.text.tag_ranges(tk.SEL)
        if selection:
            self.text.tag_add("link", *selection) 
開發者ID:PacktPublishing,項目名稱:Tkinter-GUI-Application-Development-Cookbook,代碼行數:6,代碼來源:chapter3_06.py

示例10: selectText

# 需要導入模塊: import tkinter [as 別名]
# 或者: from tkinter import SEL [as 別名]
def selectText(self, event):
        self.lfc_field_1_t.tag_add(tkinter.SEL, "1.0", tkinter.END)
        return 'break'  # 為什麽要return 'break'

    # 上傳代碼 用base64進行加密 
開發者ID:copie,項目名稱:dayworkspace,代碼行數:7,代碼來源:codegui.py


注:本文中的tkinter.SEL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。