本文整理汇总了Python中tkinter.ttk.Entry类的典型用法代码示例。如果您正苦于以下问题:Python Entry类的具体用法?Python Entry怎么用?Python Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Entry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: build_widgets
def build_widgets(self):
"Build the various widgets that will be used in the program."
# Create processing frame widgets.
self.processing_frame = LabelFrame(self, text='Processing Mode:')
self.mode_var = StringVar(self, 'encode')
self.decode_button = Radiobutton(self.processing_frame,
text='Decode Cipher-Text',
command=self.handle_radiobuttons,
value='decode',
variable=self.mode_var)
self.encode_button = Radiobutton(self.processing_frame,
text='Encode Plain-Text',
command=self.handle_radiobuttons,
value='encode',
variable=self.mode_var)
self.freeze_var = BooleanVar(self, False)
self.freeze_button = Checkbutton(self.processing_frame,
text='Freeze Key & Primer',
command=self.handle_checkbutton,
offvalue=False,
onvalue=True,
variable=self.freeze_var)
# Create encoding frame widgets.
self.encoding_frame = LabelFrame(self, text='Encoding Options:')
self.chain_size_label = Label(self.encoding_frame, text='Chain Size:')
self.chain_size_entry = Entry(self.encoding_frame)
self.plain_text_label = Label(self.encoding_frame, text='Plain-Text:')
self.plain_text_entry = Entry(self.encoding_frame)
# Create input frame widgets.
self.input_frame = LabelFrame(self, text='Input Area:')
self.input_text = ScrolledText(self.input_frame, **self.TEXT)
# Create output frame widgets.
self.output_frame = LabelFrame(self, text='Output Area:')
self.output_text = ScrolledText(self.output_frame, **self.TEXT)
开发者ID:jacob-carrier,项目名称:code,代码行数:34,代码来源:recipe-578076.py
示例2: _addNeueMahlzeitFrame
def _addNeueMahlzeitFrame(self):
self.fr_neue_mz = Frame(self.fr_mahlzeit)
self.fr_neue_mz.grid_rowconfigure(2, weight=1)
self.fr_neue_mz.grid(row=0, column=1, sticky="WSNE")
lbl_name = Label(self.fr_neue_mz, text="Name:")
lbl_name.grid(row=0, column=0, sticky="NW")
self.en_name = Entry(self.fr_neue_mz)
self.en_name.grid(row=0, column=1, columnspan=2, sticky="WNE")
lbl_zutat = Label(self.fr_neue_mz, text="Zutaten:")
lbl_zutat.grid(row=1, column=0, sticky="NW")
self.lb_zutat = Listbox(self.fr_neue_mz)
sb_zutat = Scrollbar(self.lb_zutat, orient=VERTICAL)
self.lb_zutat.configure(yscrollcommand=sb_zutat.set)
sb_zutat.configure(command=self.lb_zutat.yview)
sb_zutat.pack(side="right", fill="both")
self.lb_zutat.grid(row=2, column=0, columnspan=3, sticky="NWSE")
self.var_zutat = StringVar(self.fr_neue_mz)
self.opt_zutat = OptionMenu(self.fr_neue_mz, self.var_zutat, "Auswahl")
self.opt_zutat.grid(row=3, column=0)
self.en_menge = Entry(self.fr_neue_mz)
self.en_menge.grid(row=3, column=1)
self.btn_mahlzeit_hinzu = Button(self.fr_neue_mz, text="Hinzu")
self.btn_mahlzeit_hinzu.grid(row=3, column=2, sticky="E")
开发者ID:karacho84,项目名称:dinnerlog,代码行数:32,代码来源:gui.py
示例3: initUI
def initUI(self):
self.parent.title("Pi computation")
self.pack(fill=BOTH, expand=True)
self.grid_columnconfigure(4, weight=1)
self.grid_rowconfigure(3, weight=1)
lbl1 = Label(self, text="Digits:")
lbl1.grid(row=0, column=0, sticky=E, padx=10, pady=10)
self.ent1 = Entry(self, width=10)
self.ent1.insert(END, "4000")
self.ent1.grid(row=0, column=1, sticky=W)
lbl2 = Label(self, text="Accuracy:")
lbl2.grid(row=0, column=2, sticky=E, padx=10, pady=10)
self.ent2 = Entry(self, width=10)
self.ent2.insert(END, "100")
self.ent2.grid(row=0, column=3, sticky=W)
self.startBtn = Button(self, text="Start",
command=self.onStart)
self.startBtn.grid(row=1, column=0, padx=10, pady=5, sticky=W)
self.pbar = Progressbar(self, mode='indeterminate')
self.pbar.grid(row=1, column=1, columnspan=3, sticky=W+E)
self.txt = scrolledtext.ScrolledText(self)
self.txt.grid(row=2, column=0, rowspan=4, padx=10, pady=5,
columnspan=5, sticky=E+W+S+N)
开发者ID:chengyi818,项目名称:kata,代码行数:31,代码来源:1_calculating_pi.py
示例4: add_file_info_box
def add_file_info_box(self, mainframe, name, labeldict, btncallback, fvar):
"""
Create and add a infobox containing the info about a loaded
savegame.
"""
title = {'source':'Copy face from source file:',
'target':'To target file:'}
frame = LabelFrame(mainframe, text=title[name])
frame.pack(anchor=N, fill=X, expand=1, side=TOP, padx=0, pady=0)
frame.columnconfigure(1, weight=1)
btn = Button(frame, text='Browse', command=btncallback)
btn.grid(column=0, row=0, padx=2, pady=2)
field = Entry(frame, width=50, textvariable=fvar)
field.grid(column=1, row=0, columnspan=2, padx=2, pady=2, sticky=W+E)
l = ('name','gender','level','race','location','save number','playing time')
for n, (i, j) in enumerate([(x.capitalize()+':', x) for x in l]):
Label(frame, text=i, state=DISABLED).grid(column=0, row=n+1, padx=4,
pady=3, sticky=E)
labeldict[j] = StringVar()
Label(frame, textvariable=labeldict[j]).grid(column=1, row=n+1,
padx=4, pady=3, sticky=W)
self.screenshot[name] = Label(frame)
self.screenshot[name].grid(column=2, row=1, rowspan=len(l),
padx=4, pady=4)
开发者ID:luckydonald-forks,项目名称:FaceTransfer,代码行数:27,代码来源:facetransfer.py
示例5: DlgDelay
class DlgDelay(Dialog):
def body(self, master, cfg={}):
"place user dialog widgets"
self.config = cfg
self.config["OK button"] = False
self.delay = StringVar()
self.delay.set(cfg.get("delay", ""))
self.edelay = Entry(master, width=15, textvariable=self.delay)
self.edelay.grid(column=1, row=0, sticky="e")
Label(master, text=_("Delay:")).grid(column=0, row=0, sticky="w")
self.resizable(width=0, height=0)
return self.edelay
def validate(self):
try:
flt = float(self.delay.get())
except ValueError:
return self.edelay
if flt < 0 or flt > 5:
return self.edelay
return None
def apply(self):
"On ok button pressed"
self.config["delay"] = self.delay.get()
self.config["OK button"] = True
开发者ID:Lysovenko,项目名称:jml,代码行数:26,代码来源:dialogs.py
示例6: Form
class Form(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.parent.title("Example Form")
self.pack(fill=BOTH, expand=True)
f = Frame(self)
f.pack(fill=X)
l = Label(f, text='First Name', width=10)
l.pack(side=LEFT, padx=5, pady=5)
self.firstName = Entry(f)
self.firstName.pack(fill=X, padx=5, expand=True)
f = Frame(self)
f.pack(fill=X)
l = Label(f, text='Last Name', width=10)
l.pack(side=LEFT, padx=5, pady=5)
self.lastName = Entry(f)
self.lastName.pack(fill=X, padx=5, expand=True)
f = Frame(self)
f.pack(fill=X)
l = Label(f, text='Full Name', width=10)
l.pack(side=LEFT, padx=5, pady=5)
self.fullName = Label(f, text='ALEX POOPKIN', width=10)
self.fullName.pack(fill=X, padx=5, expand=True)
f = Frame(self)
f.pack(fill=X)
l = Label(f, text='', width=10)
l.pack(side=LEFT, padx=5, pady=0)
self.errorMessage = Label(f, text='Invalid character int the name!', foreground='red', width=30)
self.errorMessage.pack(fill=X, padx=5, expand=True)
f = Frame(self)
f.pack(fill=X)
b = Button(f, text='Close', command=lambda : self.parent.quit())
b.pack(side=RIGHT, padx=5, pady=10)
b['default'] = ACTIVE
b.focus_set()
self.clearButton = Button(f, text='Clear')
self.clearButton.pack(side=RIGHT, padx=5, pady=10)
self.clearButton['state'] = DISABLED
self.sendButton = Button(f, text='Send')
self.sendButton.pack(side=RIGHT, padx=5, pady=10)
开发者ID:alex-kooper,项目名称:knockouttk,代码行数:60,代码来源:form.py
示例7: insert_entry_field
def insert_entry_field(self, txt):
frame = Frame(self.frame)
frame.pack(fill="x")
label = Label(frame, text=txt, width=6)
label.pack(side="left", anchor="n", padx=5, pady=5)
entry = Entry(frame)
entry.pack(fill="x", padx=5, pady=5, expand=True)
self.entries["Entry"][txt] = entry
开发者ID:Exodus111,项目名称:Projects,代码行数:8,代码来源:main.py
示例8: initUI
def initUI(self):
self.parent.title("Book Manager")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
self.columnconfigure(0, pad=3)
self.columnconfigure(1, pad=3)
self.columnconfigure(2, pad=3)
self.rowconfigure(0, pad=3)
self.rowconfigure(1, pad=3)
self.rowconfigure(2, pad=3)
self.rowconfigure(3, pad=3)
self.rowconfigure(4, pad=3)
self.rowconfigure(5, pad=3)
self.rowconfigure(6, pad=3)
self.input_bname=''
self.input_aname=''
self.input_price=0
self.delete=''
lb_bookname = Label(self, text="bookname:")
lb_bookname.grid(row=0, column =0 ,sticky=W, pady=4, padx=5)
self.entry_bookname = Entry(self)
self.entry_bookname.grid(row=0, column = 1 )
lb_author = Label(self, text="author:")
lb_author.grid(row=0, column =2,sticky=W, pady=4, padx=5)
self.entry_author = Entry(self)
self.entry_author.grid(row=0, column = 3 )
lb_price = Label(self, text="price:")
lb_price.grid(row=0, column =4 ,sticky=W, pady=4, padx=5)
self.entry_price = Entry(self)
self.entry_price.grid(row=0, column = 5 ,padx=15)
abtn = Button(self, text="Add", command=lambda:self.clicked_add())
abtn.grid(row=0, column=6)
sbtn = Button(self, text="Serach", command = lambda:self.clicked_search())
sbtn.grid(row=1, column=6, pady=4)
dbtn = Button(self, text="Delete", command = lambda:self.clicked_delete())
dbtn.grid(row=2, column=6, pady=4)
self.lb = Listbox(self)
self.lb.grid(row=3,column = 0, columnspan = 6,rowspan= 4, sticky = E+W+S+N)
self.lb.bind("<<ListboxSelect>>", self.onSelect)
开发者ID:hangyeolkim91,项目名称:python,代码行数:57,代码来源:bookmanager.py
示例9: apagar_caracter_invalido
def apagar_caracter_invalido(evento_char, ref_entry: ttk.Entry, caracteres_inválidos: str):
""" Método estático para apagar os caracteres inseridos em um Entry no momento da digitação(evento Release).
Pode ser usado sem instanciação.
:param evento_char: event.char do evento.
:param ref_entry: Referência do componente Entry.
:param caracteres_inválidos: string de caracteres que deseja-se que sejam apagados.
:return: none. """
if evento_char in caracteres_inválidos:
ref_entry.delete(len(ref_entry.get()) - 1, 'end')
开发者ID:paulocsilvajr,项目名称:python-code,代码行数:9,代码来源:controle_contas.py
示例10: Main
class Main(Frame):
"""Main class for our browser.
Note that we inherit from Frame, making this a Frame object.
"""
def __init__(self, master):
Frame.__init__(self, master)
self.master = master
self.master.title("Browser")
self.header = {"User-Agent":"Tkinter Browser 0.1"}
# Here we make our widgets.
self.top_frame = Frame(self)
self.url_frame = Frame(self.top_frame)
self.url_label = Label(self.url_frame, text="Url: ", anchor="n")
self.url_entry = Entry(self.url_frame, width=80)
self.url_button = Button(self.url_frame, text="Go", command=self.go_button)
self.bottom_frame = Frame(self)
self.text_field = Text(self.bottom_frame)
#Here we pack our widgets.
self.top_frame.pack(side="top", padx=15, pady=15)
self.url_frame.pack(anchor="center")
self.bottom_frame.pack(side="bottom", fill="both", expand=True)
self.text_field.pack(side="bottom", fill="both", expand=True)
self.url_label.pack(side="left")
self.url_entry.pack(side="left", fill="x", expand=True)
self.url_button.pack(side="left", padx=5)
self.text_field.config(state="disabled", padx=5, pady=5)
def go_button(self):
url = self.url_entry.get()
if url:
if "http://" not in url:
url = "http://"+url
page_text = self.get_page(url)
self.text_field.config(state="normal")
self.text_field.delete(1.0, "end")
self.text_field.insert("end", page_text)
self.text_field.config(state="disable")
def get_page(self, url):
s = requests.Session()
resp = s.get(url, headers=self.header)
data = resp.text
soup = bs(data, "html.parser")
page_text = soup.find_all(text=True)
page_text = filter(self.visible, page_text)
return "".join([str(i)+'\n' for i in page_text])
def visible(self, e):
if e.parent.name in ('style', 'script', '[document]', 'head', 'title'):
return False
elif re.match('<!--.*-->', str(e.encode('utf-8'))):
return False
return True
开发者ID:Exodus111,项目名称:Projects,代码行数:56,代码来源:browser.py
示例11: body
def body(self, master, cfg={}):
"place user dialog widgets"
self.config = cfg
self.config["OK button"] = False
self.site = StringVar()
self.site.set(cfg.get("site", ""))
self.login = StringVar()
self.login.set(cfg.get("user", ""))
self.password = StringVar()
self.password.set(str(cfg.get("password", "")))
site = Entry(master, width=15, textvariable=self.site)
site.grid(column=1, row=0, sticky="e")
Label(master, text=_("Site:")).grid(column=0, row=0, sticky="w")
loge = Entry(master, width=15, textvariable=self.login)
loge.grid(column=1, row=1, sticky="e")
Label(master, text=_("Username:")).grid(column=0, row=1, sticky="w")
pase = Entry(master, width=15, textvariable=self.password, show="*")
pase.grid(column=1, row=2, sticky="e")
Label(master, text=_("Password:")).grid(column=0, row=2, sticky="w")
self.to_remember = IntVar()
self.to_remember.set(cfg.get("remember_passwd", 1))
chk1 = Checkbutton(master, text="Remember",
variable=self.to_remember)
chk1.grid(column=0, row=3, sticky="w", columnspan=2)
self.resizable(width=0, height=0)
return loge
开发者ID:Lysovenko,项目名称:OTRS_US,代码行数:26,代码来源:dialogs.py
示例12: make_entry
def make_entry(self, label_text, var):
'''Return (entry, label), .
entry - gridded labeled Entry for text entry.
label - Label widget, returned for testing.
'''
label = Label(self.top, text=label_text)
label.grid(row=self.row, column=0, sticky="nw")
entry = Entry(self.top, textvariable=var, exportselection=0)
entry.grid(row=self.row, column=1, sticky="nwe")
self.row = self.row + 1
return entry, label
开发者ID:1st1,项目名称:cpython,代码行数:12,代码来源:searchbase.py
示例13: initialize_ui
def initialize_ui(self):
default_padding = {'padx': 10, 'pady' : 10}
labels = ["Name", "Surname", "Email", "Cellphone"]
for label in labels:
frame = Frame(self)
Label(frame, text = label, style="BW.TLabel").pack(default_padding, side = LEFT)
entry = Entry(frame)
entry.pack(default_padding, side = RIGHT)
self.entries.append(entry)
frame.pack(expand = True, fill = "x", side = TOP)
button_frame = Frame(self)
Button(button_frame, text = "Create Customer", command = self.save_customer).pack(default_padding)
button_frame.pack(expand = True, fill = "x")
开发者ID:khlumzeemee,项目名称:3dprinter,代码行数:15,代码来源:ApplicationMVC.py
示例14: create_widgets
def create_widgets(self): # Call from override, if any.
# Bind to self widgets needed for entry_ok or unittest.
self.frame = frame = Frame(self, padding=10)
frame.grid(column=0, row=0, sticky='news')
frame.grid_columnconfigure(0, weight=1)
entrylabel = Label(frame, anchor='w', justify='left',
text=self.message)
self.entryvar = StringVar(self, self.text0)
self.entry = Entry(frame, width=30, textvariable=self.entryvar)
self.entry.focus_set()
self.error_font = Font(name='TkCaptionFont',
exists=True, root=self.parent)
self.entry_error = Label(frame, text=' ', foreground='red',
font=self.error_font)
self.button_ok = Button(
frame, text='OK', default='active', command=self.ok)
self.button_cancel = Button(
frame, text='Cancel', command=self.cancel)
entrylabel.grid(column=0, row=0, columnspan=3, padx=5, sticky=W)
self.entry.grid(column=0, row=1, columnspan=3, padx=5, sticky=W+E,
pady=[10,0])
self.entry_error.grid(column=0, row=2, columnspan=3, padx=5,
sticky=W+E)
self.button_ok.grid(column=1, row=99, padx=5)
self.button_cancel.grid(column=2, row=99, padx=5)
开发者ID:1st1,项目名称:cpython,代码行数:27,代码来源:query.py
示例15: body
def body( self, master ):
"""
Override the empty ModalDialog.body function
to set up the dialog how we want it.
"""
from tkinter.ttk import Label, Entry
Label( master, text="First:" ).grid( row=0 )
Label( master, text="Second:" ).grid( row=1 )
self.e1 = Entry( master )
self.e2 = Entry( master )
self.e1.grid( row=0, column=1 )
self.e2.grid( row=1, column=1 )
return self.e1 # initial focus
开发者ID:alerque,项目名称:Biblelator,代码行数:16,代码来源:ModalDialog.py
示例16: __init__
def __init__(self, url):
self.url = url
self.root = Tk()
self.root.title("验证码")
while True:
try:
image_bytes = urlopen(self.url).read()
break
except socket.timeout:
print('获取验证码超时:%s\r\n重新获取.' % (self.url))
continue
except urllib.error.URLError as e:
if isinstance(e.reason, socket.timeout):
print('获取验证码超时:%s\r\n重新获取.' % (self.url))
continue
# internal data file
data_stream = io.BytesIO(image_bytes)
# open as a PIL image object
self.pil_image = Image.open(data_stream)
# convert PIL image object to Tkinter PhotoImage object
self.tk_image = ImageTk.PhotoImage(self.pil_image)
self.label = Label(self.root, image=self.tk_image, background='brown')
self.label.pack(padx=5, pady=5)
self.button = Button(self.root, text="刷新验证码", command=self.refreshImg)
self.button.pack(padx=5, pady=5)
randCodeLable = Label(self.root, text="验证码:")
randCodeLable.pack(padx=5, pady=5)
self.randCode = Entry(self.root)
self.randCode.pack(padx=5, pady=5)
self.loginButton = Button(self.root, text="登录", default=tkinter.ACTIVE)
self.loginButton.pack(padx=5, pady=5)
开发者ID:stonezyl,项目名称:urbtix,代码行数:35,代码来源:LoginUI.py
示例17: initUI
def initUI(self):
self.master.title("3D Printer - Add Customer")
self.style = Style()
default_padding = {'padx': 10, 'pady' : 10}
#TODO change alignment
#Left frame for labels
self.left_frame = Frame(self.master)
self.name_label = Label(self.left_frame, text = "Name", style="BW.TLabel")
self.name_label.pack(default_padding)
self.surname_label = Label(self.left_frame, text = "Surname", style="BW.TLabel")
self.surname_label.pack(default_padding)
self.email_label = Label(self.left_frame, text = "Email", style="BW.TLabel")
self.email_label.pack(default_padding)
self.cellphone_label = Label(self.left_frame, text = "Cellphone", style="BW.TLabel")
self.cellphone_label.pack(default_padding)
#Right frame for entries
self.right_frame = Frame(self.master)
self.name_entry = Entry(self.right_frame)
self.name_entry.pack(default_padding)
self.surname_entry = Entry(self.right_frame)
self.surname_entry.pack(default_padding)
self.email_entry = Entry(self.right_frame)
self.email_entry.pack(default_padding)
self.cellphone_entry = Entry(self.right_frame)
self.cellphone_entry.pack(default_padding)
#Bottom frame for button
self.button_frame = Frame(self.master)
self.create_customer_button = Button(self.button_frame, text = "Create Customer", command = self.save_customer)
self.create_customer_button.pack(default_padding)
self.button_frame.pack(side = BOTTOM, fill = "x", expand = True)
self.left_frame.pack(side = LEFT, expand = True, fill = "y")
self.right_frame.pack(side = RIGHT, expand = True, fill = "y")
self.frame.pack()
开发者ID:khlumzeemee,项目名称:3dprinter,代码行数:47,代码来源:Application.py
示例18: add_entry
def add_entry(self, text):
entry = Entry(self)
entry.insert(0, ",".join(text))
entry.pack(fill="both", expand=True)
entry.config(state="readonly")
self.bindings(entry)
self.entries.append(entry)
开发者ID:Exodus111,项目名称:Projects,代码行数:7,代码来源:mod_items.py
示例19: create_widgets
def create_widgets(self):
super().create_widgets()
frame = self.frame
pathlabel = Label(frame, anchor="w", justify="left", text="Help File Path: Enter URL or browse for file")
self.pathvar = StringVar(self, self.filepath)
self.path = Entry(frame, textvariable=self.pathvar, width=40)
browse = Button(frame, text="Browse", width=8, command=self.browse_file)
pathlabel.pack(anchor="w", padx=5, pady=3)
self.path.pack(anchor="w", padx=5, pady=3)
browse.pack(pady=3)
开发者ID:abalkin,项目名称:cpython,代码行数:11,代码来源:query.py
示例20: body
def body(self, master, cfg={}):
"place user dialog widgets"
self.config = cfg
self.config["OK button"] = False
self.delay = StringVar()
self.delay.set(cfg.get("delay", ""))
self.edelay = Entry(master, width=15, textvariable=self.delay)
self.edelay.grid(column=1, row=0, sticky="e")
Label(master, text=_("Delay:")).grid(column=0, row=0, sticky="w")
self.resizable(width=0, height=0)
return self.edelay
开发者ID:Lysovenko,项目名称:jml,代码行数:11,代码来源:dialogs.py
注:本文中的tkinter.ttk.Entry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论