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


Python Tkinter.Entry方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def __init__(self, main_window, msg='Please enter a node:'):
        tk.Toplevel.__init__(self)
        self.main_window = main_window
        self.title('Node Entry')
        self.geometry('170x160')
        self.rowconfigure(3, weight=1)

        tk.Label(self, text=msg).grid(row=0, column=0, columnspan=2,
                                      sticky='NESW',padx=5,pady=5)
        self.posibilities = [d['dataG_id'] for n,d in
                    main_window.canvas.dispG.nodes_iter(data=True)]
        self.entry = AutocompleteEntry(self.posibilities, self)
        self.entry.bind('<Return>', lambda e: self.destroy(), add='+')
        self.entry.grid(row=1, column=0, columnspan=2, sticky='NESW',padx=5,pady=5)

        tk.Button(self, text='Ok', command=self.destroy).grid(
            row=3, column=0, sticky='ESW',padx=5,pady=5)
        tk.Button(self, text='Cancel', command=self.cancel).grid(
            row=3, column=1, sticky='ESW',padx=5,pady=5)

        # Make modal
        self.winfo_toplevel().wait_window(self) 
開發者ID:jsexauer,項目名稱:networkx_viewer,代碼行數:24,代碼來源:viewer.py

示例2: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def __init__(self, master=None, widget=None, **kw):
        """Constructs a Ttk Entry widget with the parent master.

        STANDARD OPTIONS

            class, cursor, style, takefocus, xscrollcommand

        WIDGET-SPECIFIC OPTIONS

            exportselection, invalidcommand, justify, show, state,
            textvariable, validate, validatecommand, width

        VALIDATION MODES

            none, key, focus, focusin, focusout, all
        """
        Widget.__init__(self, master, widget or "ttk::entry", kw) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:19,代碼來源:ttk.py

示例3: show_mnemonic_gui

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def show_mnemonic_gui(mnemonic_sentence):
    """may be called *after* main() to display the successful result iff the GUI is in use

    :param mnemonic_sentence: the mnemonic sentence that was found
    :type mnemonic_sentence: unicode
    :rtype: None
    """
    assert tk_root
    global pause_at_exit
    padding = 6
    tk.Label(text="WARNING: seed information is sensitive, carefully protect it and do not share", fg="red") \
        .pack(padx=padding, pady=padding)
    tk.Label(text="Seed found:").pack(side=tk.LEFT, padx=padding, pady=padding)
    entry = tk.Entry(width=80, readonlybackground="white")
    entry.insert(0, mnemonic_sentence)
    entry.config(state="readonly")
    entry.select_range(0, tk.END)
    entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=padding, pady=padding)
    tk_root.deiconify()
    tk_root.lift()
    entry.focus_set()
    tk_root.mainloop()  # blocks until the user closes the window
    pause_at_exit = False 
開發者ID:gurnec,項目名稱:btcrecover,代碼行數:25,代碼來源:btcrseed.py

示例4: build_bm_gui_table

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def build_bm_gui_table(self,*event):

            for element in self.beam_gui_list:
                element.destroy()

            del self.beam_gui_list[:]

            for i,bm in enumerate(self.beam_inputs):

                a = tk.Entry(self.bm_info_tab,textvariable=bm[0], width=8, state=tk.DISABLED)
                a.grid(row=i+2,column=1, pady=4)
                b = tk.Entry(self.bm_info_tab,textvariable=bm[1], width=8)
                b.grid(row=i+2,column=2)
                c = tk.Entry(self.bm_info_tab,textvariable=bm[2], width=8)
                c.grid(row=i+2,column=3)
                d = tk.Entry(self.bm_info_tab,textvariable=bm[3], width=8)
                d.grid(row=i+2,column=4)

                self.beam_gui_list.extend([a,b,c,d]) 
開發者ID:buddyd16,項目名稱:Structural-Engineering,代碼行數:21,代碼來源:Frame_2D_GUI_metric.py

示例5: _make_file_select

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def _make_file_select(self, parent, rowidx, label):
        # Create string variable.
        tkstr = tk.StringVar()
        # Create callback event handler.
        cmd = lambda: self._file_select(tkstr)
        # Create the Label, Entry, and Button objects.
        label = tk.Label(parent, text=label)
        entry = tk.Entry(parent, textvariable=tkstr)
        button = tk.Button(parent, text='...', command=cmd)
        label.grid(row=rowidx, column=0, sticky='W')
        entry.grid(row=rowidx, column=1)
        button.grid(row=rowidx, column=2)
        return tkstr

    # Set status text, and optionally update cursor. 
開發者ID:ooterness,項目名稱:DualFisheye,代碼行數:17,代碼來源:fisheye.py

示例6: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def __init__(self, master=None, **kw):
        if platform == 'darwin':
            kw['highlightbackground'] = kw.pop('highlightbackground', PAGEBG)
            tk.Entry.__init__(self, master, **kw)
        else:
            ttk.Entry.__init__(self, master, **kw) 
開發者ID:EDCD,項目名稱:EDMarketConnector,代碼行數:8,代碼來源:myNotebook.py

示例7: initialize

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def initialize(self):
		L = Tkinter.Label(master=self,text="Targeted IP:")
		L.pack()
		self.E = Tkinter.Entry(master=self,width=50)
		self.E.pack()
		B= Tkinter.Button(master=self,text='Check IP',command=self.checkIp)
		B.pack()
		self.grid() 
開發者ID:HoussemCharf,項目名稱:FunUtils,代碼行數:10,代碼來源:Torrent_ip_checker.py

示例8: preferences

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def preferences(self, event=None):
        preferenceTop = tkinter.Toplevel()
        preferenceTop.focus_set()
        
        notebook = ttk.Notebook(preferenceTop)
        
        frame1 = ttk.Frame(notebook)
        notebook.add(frame1, text='general')
        frame2 = ttk.Frame(notebook)
        notebook.add(frame2, text='shortcuts')

        c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word)
        c.pack()
        
        shortcuts_vars = []
        shortcuts_gui = []
        cur_row = 0
        j = -1
        frame_list = []
        frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts"))
        frame_list[-1].pack(fill="both", expand="yes")
        for i, shortcut in enumerate(self.shortcuts):
            j += 1
            key, cmd, bindings = shortcut
            name, command = cmd
            shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key))
            tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W)
            entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j])
            entry.grid(row=cur_row, column=1)
            cur_row += 1
        notebook.pack()
    
    #
    # ? menu methods
    # 
開發者ID:YoannDupont,項目名稱:SEM,代碼行數:37,代碼來源:annotation_gui.py

示例9: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def __init__(self, parent, msg, title, hidden, text_variable):
        tk.Frame.__init__(self, parent)
        self.parent = parent
        self.parent.protocol("WM_DELETE_WINDOW", self.cancel_function)
        self.parent.bind('<Return>', self.ok_function)
        self.parent.title(title)
        self.input_text = text_variable
        if Settings.PopupLocation:
            self.parent.geometry("+{}+{}".format(
                Settings.PopupLocation.x,
                Settings.PopupLocation.y))
        self.msg = tk.Message(self.parent, text=msg)
        self.msg.grid(row=0, sticky="NSEW", padx=10, pady=10)
        self.input_entry = tk.Entry(self.parent, width=50, textvariable=self.input_text)
        if hidden:
            self.input_entry.config(show="*")
        self.input_entry.grid(row=1, sticky="EW", padx=10)
        self.button_frame = tk.Frame(self.parent)
        self.button_frame.grid(row=2, sticky="E")
        self.cancel = tk.Button(
            self.button_frame,
            text="Cancel",
            command=self.cancel_function,
            width=10)
        self.cancel.grid(row=0, column=0, padx=10, pady=10)
        self.ok_button = tk.Button(
            self.button_frame,
            text="Ok",
            command=self.ok_function,
            width=10)
        self.ok_button.grid(row=0, column=1, padx=10, pady=10)
        self.input_entry.focus_set() 
開發者ID:glitchassassin,項目名稱:lackey,代碼行數:34,代碼來源:SikuliGui.py

示例10: create

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def create(self, **kwargs):
        return tkinter.Entry(self.root, **kwargs) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:4,代碼來源:test_widgets.py

示例11: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def __init__(self, parent):
        tk.LabelFrame.__init__(self, parent, text="Plot Custom Range")
        self.parent = parent
        self.lab = tk.Label(self, text='Custom range:')
        self.rangeVar = tk.StringVar(value='chrX:YYYYYY-ZZZZZZ')
        self.entry = tk.Entry(self, textvariable=self.rangeVar, width=25)
        self.setter = tk.Button(self, text="Plot Custom", command=self.do_plot)
        self.lab.grid(row=0, column=0, sticky=tk.NSEW)
        self.entry.grid(row=0, column=1, sticky=tk.NSEW)
        self.setter.grid(row=0, column=2, sticky=tk.NSEW) 
開發者ID:VCCRI,項目名稱:SVPV,代碼行數:12,代碼來源:gui_widgets.py

示例12: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def __init__(self, master, *scripts, **opts):

    # build gui:
    Tkinter.Frame.__init__(self, master, **opts)
    master.title("Py-Span-Task")

    self.scripts = list(scripts)
    self.opts = {}

    self.display_var = Tkinter.StringVar("")
    width = master.winfo_screenwidth()
    self.display = Tkinter.Message(self, justify=LEFT, textvar=self.display_var,
                     font=(fontname, fontsize),
                     width=width-(width/10), bg="white")
    self.display.pack(fill=BOTH, expand=1)

    self.entry_var = Tkinter.StringVar("")
    self.entry = Tkinter.Entry(self, font=(fontname, fontsize),
                               state="disabled",
                               textvar=self.entry_var)
    self.entry.pack(fill=X)
    self.entry.bind('<Return>', lambda e:self.key_pressed('<Return>'))

    self.bind('<space>', lambda e:self.key_pressed('<space>'))

    # Sometimes lexical closures suck:
    def event_handler_creator(frame, key):
      return lambda e:frame.key_pressed(key)

    for v in responses.values():
      self.bind(v, event_handler_creator(self, v))

    self.focus_set()

    self.key_pressed(None) 
開發者ID:tmalsburg,項目名稱:py-span-task,代碼行數:37,代碼來源:pyspantask.py

示例13: configPasswordEntry

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def configPasswordEntry(self):
        """Gui Password Entry Configuration"""
        self.startButton.config(text=_("Open Sessions"), state=tkinter.NORMAL)
        self.chooseNsfButton.config(text=_("Select Directory of SOURCE nsf files"),
                                    state=tkinter.DISABLED)
        self.chooseDestButton.config(text=_("Select Directory of DESTINATION files"),
                                     state=tkinter.DISABLED)
        self.entryPassword.config(state=tkinter.NORMAL)
        self.formatTypeEML.config(state=tkinter.DISABLED)
        self.formatTypeMBOX.config(state=tkinter.DISABLED)
        self.formatTypePST.config(state=tkinter.DISABLED)
        self.optionsButton.config(state=tkinter.DISABLED) 
開發者ID:adb014,項目名稱:nsf2x,代碼行數:14,代碼來源:nsf2x.py

示例14: configDirectoryEntry

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def configDirectoryEntry(self, SetDefaultPath=True):
        """Gui Directory Entry Configuration"""
        self.startButton.config(text=_("Convert"), state=tkinter.NORMAL)
        self.entryPassword.config(state=tkinter.DISABLED)
        self.formatTypeEML.config(state=tkinter.NORMAL)
        self.formatTypeMBOX.config(state=tkinter.NORMAL)
        self.formatTypePST.config(state=tkinter.NORMAL)
        self.optionsButton.config(state=tkinter.NORMAL)

        if SetDefaultPath:
            op = None
            try:
                op = os.path.join(os.path.dirname(self.Lotus.URLDatabase.FilePath), 'archive')
            except (pywintypes.com_error, OSError): # pylint: disable=E1101
                try:
                    op = os.path.join(os.path.expanduser('~'), 'archive')
                except OSError:
                    op = None
            finally:
                if os.path.exists(op):
                    self.nsfPath = op
                else:
                    self.nsfPath = '.'

            sp = os.path.join(os.path.expanduser('~'), 'Documents')
            if os.path.exists(sp):
                self.destPath = sp
            else:
                self.destPath = '.'

        self.chooseNsfButton.config(text=_("Source directory is : %s") % self.nsfPath)
        self.chooseNsfButton.config(state=tkinter.NORMAL)
        self.chooseDestButton.config(text=_("Destination directory is %s") % self.destPath)
        self.chooseDestButton.config(state=tkinter.NORMAL) 
開發者ID:adb014,項目名稱:nsf2x,代碼行數:36,代碼來源:nsf2x.py

示例15: __init__

# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import Entry [as 別名]
def __init__(self, master):
    self.master = master
    self.frame = Tkinter.Frame(self.master)

    ###Setup GUI buttons and labels for entering power factor###

    self.buttonPwrFact = Tkinter.Button(self.frame,height=1, width=20,text=u"Set power factor",command=self.serPwrFactorbutton)
    self.buttonPwrFact.grid(column=0,row=0)

    self.PwrFactVariable = Tkinter.StringVar()
    self.entry = Tkinter.Entry(self.frame,textvariable=self.PwrFactVariable)
    self.entry.grid(column=0,row=1,sticky='EW')

    self.frame.pack() 
開發者ID:john-38787364,項目名稱:antifier,代碼行數:16,代碼來源:antifier.py


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