本文整理汇总了Python中ttk.Entry.place方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.place方法的具体用法?Python Entry.place怎么用?Python Entry.place使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Entry
的用法示例。
在下文中一共展示了Entry.place方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from ttk import Entry [as 别名]
# 或者: from ttk.Entry import place [as 别名]
def initUI(self):
self.parent.title("Software Activation")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
if(self.needsActivated()):
idEntry = Entry(self, width=36)
idEntry.place(x=175, y=20)
idEntry.delete(0, END)
idEntry.insert(0, "Enter a product id")
keyEntry = Entry(self, width=36)
keyEntry.place(x=175, y=40)
keyEntry.delete(0, END)
keyEntry.insert(0, "Enter your license key")
activateButton = Button(self, text="Activate",
command=lambda:self.activate(
idEntry.get(), keyEntry.get()))
activateButton.place(x=250, y=65)
else:
label = Label(self, text="Product has already been activated")
label.pack()
示例2: Window
# 需要导入模块: from ttk import Entry [as 别名]
# 或者: from ttk.Entry import place [as 别名]
class Window(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.style = Style()
self.style.theme_use("clam")
self.pack(fill=BOTH,expand=5)
self.parent.title("Document Similarity Checker")
self.dir = "Choose a directory"
self.setupInputs()
self.setButton()
def setupInputs(self):
self.chooseDir = Button(self, text="Choose",command=self.getDir)
self.chooseDir.place(x=10, y=10)
self.selpath = Label(self, text=self.dir, font=("Helvetica", 12))
self.selpath.place(x=150, y=10)
self.aLabel = Label(self, text="Alpha", font=("Helvetica", 12))
self.aLabel.place(x=10, y=50)
self.aEntry = Entry()
self.aEntry.place(x=200,y=50,width=400,height=30)
self.bLabel = Label(self, text="Beta", font=("Helvetica", 12))
self.bLabel.place(x=10, y=100)
self.bEntry = Entry()
self.bEntry.place(x=200,y=100,width=400,height=30)
def setButton(self):
self.quitButton = Button(self, text="Close",command=self.quit)
self.quitButton.place(x=520, y=250)
self.browserButton = Button(self, text="Open Browser",command=self.browser)
self.browserButton.place(x=400, y=250)
self.browserButton.config(state=DISABLED)
self.generate = Button(self, text="Generate Data",command=self.genData)
self.generate.place(x=10, y=250)
def browser(self):
import webbrowser
webbrowser.get('firefox').open('data/index.html')
self.browserButton.config(state=DISABLED)
def getDir(self):
globals.dir = tkFileDialog.askdirectory(parent=self.parent,initialdir="/",title='Select a directory')
self.selpath['text'] = globals.dir
#print globals.dir
#validate and process data
def genData(self):
valid = True
try:
globals.alpha = float(self.aEntry.get())
except ValueError:
globals.alpha = 0.0
valid = False
try:
globals.beta = float(self.bEntry.get())
except ValueError:
globals.beta = 0.0
valid = False
if not os.path.isdir(globals.dir) or globals.alpha>=1.0 or globals.beta>=1.0:
valid = False
if valid:
self.generate.config(state=DISABLED)
from compute import main as computeMain
computeMain()
from jsonutil import main as jsonMain
jsonMain()
self.browserButton.config(state=NORMAL)
self.generate.config(state=NORMAL)
示例3: Example
# 需要导入模块: from ttk import Entry [as 别名]
# 或者: from ttk.Entry import place [as 别名]
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Append Data")
self.pack(fill=BOTH, expand=True)
labelfont20 = ('Roboto', 15, 'bold')
labelfont10 = ('Roboto', 10, 'bold')
labelfont8 = ('Roboto', 8, 'bold')
frame0 = Frame(self)
frame0.pack()
lbl0 = Label(frame0, text="Hi Nakul")
lbl0.config(font=labelfont20)
lbl0.pack( padx=5, pady=5)
lbl00 = Label(frame0, text="Fill the data here")
lbl00.config(font=labelfont10)
lbl00.pack( padx=5, pady=5)
####################################
frame1 = Frame(self)
frame1.pack()
frame1.place(x=50, y=100)
lbl1 = Label(frame1, text="Name", width=15)
lbl1.pack(side=LEFT,padx=7, pady=5)
self.entry1 = Entry(frame1,width=20)
self.entry1.pack(padx=5, expand=True)
####################################
frame2 = Frame(self)
frame2.pack()
frame2.place(x=50, y=130)
lbl2 = Label(frame2, text="F Name", width=15)
lbl2.pack(side=LEFT, padx=7, pady=5)
self.entry2 = Entry(frame2)
self.entry2.pack(fill=X, padx=5, expand=True)
######################################
frame3 = Frame(self)
frame3.pack()
frame3.place(x=50, y=160)
lbl3 = Label(frame3, text="DOB(D/M/Y)", width=15)
lbl3.pack(side=LEFT, padx=7, pady=5)
self.entry3 = Entry(frame3)
self.entry3.pack(fill=X, padx=5, expand=True)
#######################################
frame4 = Frame(self)
frame4.pack()
frame4.place(x=50, y=190)
lbl4 = Label(frame4, text="Medium(H/E)", width=15)
lbl4.pack(side=LEFT, padx=7, pady=5)
self.entry4 = Entry(frame4)
self.entry4.pack(fill=X, padx=5, expand=True)
##########################################
frame5 = Frame(self)
frame5.pack()
frame5.place(x=50, y=225)
MODES = [
("M", "Male"),
("F", "Female"),
]
lbl5 = Label(frame5, text="Gender", width=15)
lbl5.pack(side=LEFT, padx=7, pady=5)
global v
v = StringVar()
v.set("Male") # initialize
for text, mode in MODES:
b = Radiobutton(frame5, text=text,variable=v, value=mode)
b.pack(side=LEFT,padx=10)
############################################
#####printing line
lbl5a = Label(text="___________________________________________________")
lbl5a.pack()
lbl5a.place(x=45, y=255)
############################################
frame6 = Frame(self)
#.........这里部分代码省略.........
示例4: Example
# 需要导入模块: from ttk import Entry [as 别名]
# 或者: from ttk.Entry import place [as 别名]
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Filter Data")
self.pack(fill=BOTH, expand=True)
labelfont20 = ('Roboto', 15, 'bold')
labelfont10 = ('Roboto', 10, 'bold')
labelfont8 = ('Roboto', 8, 'bold')
frame0 = Frame(self)
frame0.pack()
lbl0 = Label(frame0, text="Hi Nakul")
lbl0.config(font=labelfont20)
lbl0.pack( padx=5, pady=5)
lbl00 = Label(frame0, text="Filter Data")
lbl00.config(font=labelfont10)
lbl00.pack( padx=5, pady=5)
####################################
##########################################
############################################
#####printing line
lbl5a = Label(text="__________________________________")
lbl5a.pack()
lbl5a.place(x=170, y=300)
lbl5b = Label(text="__________________________________")
lbl5b.pack()
lbl5b.place(x=480, y=300)
self.lbl5c = Label(text="Search Result Will Appear Here")
self.lbl5c.pack()
self.lbl5c.place(x=170, y=320)
self.lbl5d = Label(text="File Name Will Appear Here")
self.lbl5d.pack()
self.lbl5d.place(x=480, y=320)
############################################
#############################################
###############################################
##############################################
#############################################
frame11 = Frame(self)
frame11.pack()
frame11.place(x=200, y=100)
lbl11x = Label(frame11,text="Class 10th %")
lbl11x.pack(padx=0, pady=0)
self.entry11 = Entry(width=12)
self.entry11.pack(padx=1, expand=True)
self.entry11.place(x=200, y=120)
####################################################
frame12 = Frame(self)
frame12.pack()
frame12.place(x=380, y=100)
lbl12x = Label(frame12,text="Class 12th %")
lbl12x.pack(padx=0, pady=0)
self.entry12 = Entry(width=12)
self.entry12.pack(padx=1, expand=True)
self.entry12.place(x=380, y=120)
#####################################################
frame13 = Frame(self)
frame13.pack()
frame13.place(x=550, y=100)
#.........这里部分代码省略.........
示例5: Example
# 需要导入模块: from ttk import Entry [as 别名]
# 或者: from ttk.Entry import place [as 别名]
class Example(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.parent.title("Jo Ion Picker")
self.pack(fill=BOTH, expand=1)
self.compounds = deisotope(filename=input_file)
self.error_label = Label(self, text="Error in ppm")
self.error_label.place(x=20, y=730)
self.entry = Entry(self, text='error in ppm')
self.entry.place(x=20, y=750)
self.entry.insert(10,'5')
self.b = Button(self, text="ReCalc Error", width=15, \
command=self.callback)
self.b.place(x=20, y=770)
self.b_output = Button(self, text="Export", width=10, command=self.write_output)
self.b_output.place(x=20, y=800)
#self.b_output = Button(self, text="Allowed", width=10, command=self.only_allowed_ions)
#self.b_output.place(x=20, y=830)
self.gaps=IntVar()
self.check_gaps = Checkbutton(self, text='Remove Gaps', variable=self.gaps,onvalue=1, offvalue=0, command=self.remove_gaps_call)
#self.check.pack()
self.check_gaps.place(x=20, y=830)
self.scrollbar = Scrollbar(self, orient=VERTICAL)
self.lb = Listbox(self, height=46, yscrollcommand=self.scrollbar.set)
self.scrollbar.config(command=self.lb.yview)
self.scrollbar.pack(side=LEFT, fill=Y)
for compound in self.compounds:
print "found", compound.get_base_peak()
mzs = compound.get_mz_list()
num_mzs = len(mzs)
entry = str(mzs[0]) + " " + str(num_mzs)
self.lb.insert(END, entry)
self.lb.bind("<<ListboxSelect>>", self.onSelect)
self.lb.place(x=20, y=20)
self.var = StringVar()
#self.label = Label(self, text=0, textvariable=self.var)
#self.label.place(x=20, y=710)
self.mz_label = Label(self, text="M/Z Num Ions")
self.mz_label.place(x=20, y=0)
f = Figure(figsize=(8,11), dpi=100)
self.ax = f.add_subplot(111)
mass_list = self.compounds[0].get_mz_list()
print mass_list
intensity_list = self.compounds[0].get_intensity_list()
mass_spec_plot = self.ax.bar(mass_list, intensity_list,\
width=0.05)
min_mz = mass_list[0]
max_mz = mass_list[-1]
self.ax.set_xlim([min_mz-1, max_mz+1])
self.ax.set_ylim([0, 1.1*max(intensity_list)])
self.ax.set_xticks(mass_list)
self.ax.set_xticklabels(mass_list, rotation=45)
self.ax.set_title("Base Ion:" + str(mass_list[0]))
self.canvas = FigureCanvasTkAgg(f, master=self)
self.canvas.show()
self.canvas.get_tk_widget().pack(side=RIGHT)
def onSelect(self, val):
sender = val.widget
idx = sender.curselection()
value = sender.get(idx)
self.var.set(value)
mz_to_search = value.split()[0]
self.ax.clear()
for i, compound in enumerate(self.compounds):
if float(mz_to_search) == compound.get_base_peak():
index = i
mass_list = self.compounds[index].get_mz_list()
print mass_list
intensity_list = self.compounds[index].get_intensity_list()
mass_spec_plot = self.ax.bar(mass_list, intensity_list,\
#.........这里部分代码省略.........