本文整理汇总了Python中tkinter.ttk.Combobox.grid方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.grid方法的具体用法?Python Combobox.grid怎么用?Python Combobox.grid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Combobox
的用法示例。
在下文中一共展示了Combobox.grid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Main
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
class Main():
def __init__(self):
f=open('degur.yaml','r',encoding='utf-8')
self.data=yaml.load(f.read())
f.close()
root=Tk()
root.wm_title('Дежурства v 0.1.1 (c) 2013-2015, Shershakov D.')
root.geometry('{0}x{1}+0+0'.format(root.winfo_screenwidth()-10,root.winfo_screenheight()-80))
root.rowconfigure(1,weight=1)
root.columnconfigure(1,weight=1)
root.columnconfigure(2,weight=1)
f0=Frame(root)
f1=Frame(root)
f2=Frame(root)
self.y=Combobox(f0,width=4)
self.m=Combobox(f0,width=4)
self.y.grid(row=0,column=0)
self.m.grid(row=1,column=0)
self.y.bind('<<ComboboxSelected>>',self.setY)
self.m.bind('<<ComboboxSelected>>',self.setM)
f0.grid(row=0,column=0,rowspan=10,sticky=N+S+E+W)
f1.grid(row=1,column=1,sticky=N+S+E+W)
f2.grid(row=1,column=2,sticky=N+S+E+W)
self.g1=Gr(f1,self.data)
self.g2=Gr(f2,self.data,SCRY=self.g1.scrY)
self.set0()
self.g1.yview2=self.g2.yview
root.bind('<F1>',lambda e: MyHelp(root,self.data,self.y.get()))
root.bind_all('<Control-F3>',lambda e: statistic_q(self.data,self.y.get(),v='план'))
root.bind_all('<Shift-F3>',lambda e: statistic_q(self.data,self.y.get(),v='табель'))
root.bind_all('<Control-F4>',lambda e: statistic(self.data,self.y.get(),v='план'))
root.bind_all('<Shift-F4>',lambda e: statistic(self.data,self.y.get(),v='табель'))
root.bind_all('<F3>',lambda e: statistic_q(self.data,self.y.get(),v='авто'))
root.bind_all('<F4>',lambda e: statistic(self.data,self.y.get(),v='авто'))
root.bind_all('<F5>',lambda e: tabel(self.data,self.y.get(),self.m.get()))
root.bind_all('<F7>',lambda e: otp(self.data,self.y.get(),v='авто'))
root.bind_all('<F8>',lambda e: statistic_xx(self.data,self.y.get(),v='авто'))
root.bind_all('<F9>',lambda e: per(self.data,self.y.get(),v='авто'))
root.bind_all('<Control-F8>',lambda e: statistic_xx(self.data,self.y.get(),v='план'))
FreeConsole()
root.mainloop()
def set0(self,*e):
Y=sorted(list(self.data.keys()))
self.y['values']=Y
self.y.set(Y[0])
self.setY(*e)
def setY(self,*e):
M=sorted([x for x in self.data[self.y.get()] if str(x).isnumeric()])
self.m['values']=M
self.m.set(M[0])
self.setM(*e)
def setM(self,*e):
y=self.y.get()
m=self.m.get()
self.g1.set(y,m)
self.g2.set(y,m)
示例2: __make_widgets
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
def __make_widgets(self):
widgets = {}
for index, editor_field in enumerate(self.editor_fields):
label = Label(self, width=50, padding=5, text=editor_field.title())
combo = Combobox(self, width=100)
widgets[editor_field] = {}
widgets[editor_field]['label'] = label
widgets[editor_field]['widget'] = combo
label.grid(row=index, column=0)
combo.grid(row=index, column=1)
index += 1
label = Label(self, width=50, padding=5, text="Pictures")
button = Button(self, text="...", command=self.__load_pictures)
label.grid(row=index, column=0)
button.grid(row=index, column=1)
return widgets
示例3: SliderParameter
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
class SliderParameter(Frame):
"""
A frame contening additionnals parameters for filter (represented by a SliderFrequency)
to set the type and the Q factor
parameters:
root: Canvas
the canvas to place the SliderParameter
type: String
A string representing the type of a filter
Q: String
the Q factor of a filter
id: int
ID of th SliderParameter
"""
def __init__(self,root, type, Q, id):
Frame.__init__(self,root)
self.root = root
self.typeFilter = StringVar()
self.typeFilter.set(type)
self.qFactor = StringVar()
self.qFactor.set(Q)
self.id = id
self.initialize()
def initialize(self):
""" Initialize the combobox contening all available type of filter
and the entry text to choose the value of Q factor
"""
self.typeCombo = Combobox(self.root, textvariable=self.typeFilter, values=F.values(), width="5")
self.typeCombo.grid(row=1,column=self.id, padx=10)
self.qText = Entry(self.root, textvariable=self.qFactor, width="5")
self.qText.grid(row=2,column=self.id, padx=10, pady=5)
def getQ(self):
""" return the value of the Q factor """
return self.qFactor.get()
def getType(self):
""" Return the type of the filter """
return self.typeCombo.get()
示例4: build_combobox_with_label
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
def build_combobox_with_label(values, master, row, col, toggle_background_elements):
def toggle_display():
for element in toggle_background_elements:
if var.get() == 'True':
element.configure(state='normal')
elif var.get() == 'False':
element.configure(state='disabled')
frame = Frame(master=master, bg='#FFCFC9')
frame.grid(row=row, column=col, padx=5)
label = Label(master=frame, text='Is logged in: ', justify=LEFT)
label.config(justify='right', bg='white')
label.grid(row=0, column=0, pady=2.5)
var = StringVar(master=frame, value=values[0])
cb = Combobox(master=frame, textvariable=var)
cb['values'] = values
cb.grid(row=0, column=1)
cb.bind('<<ComboboxSelected>>', lambda x: (var.set(cb.get()), toggle_display()))
if var.get() == 'False':
for element in toggle_background_elements:
element.configure(state='disabled')
return frame, var
示例5: create_widgets
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
def create_widgets(self, names):
''' Creates appropriate widgets.
Args:
names (list of str): list of available sheet names.
'''
sheet_name_lbl = Label(self,
text='Choose sheet name where data is stored:')
sheet_name_lbl.grid(sticky=N+W, padx=5, pady=5)
sheet_names_box = Combobox(self, state="readonly", width=20,
textvariable=self.sheet_name_str,
values=names)
sheet_names_box.current(0)
sheet_names_box.grid(row=1, column=0, columnspan=2,
sticky=N+W, padx=5, pady=5)
ok_btn = Button(self, text='OK', command=self.ok)
ok_btn.grid(row=2, column=0, sticky=N+E, padx=5, pady=5)
ok_btn.bind('<Return>', self.ok)
ok_btn.focus()
cancel_btn = Button(self, text='Cancel', command=self.cancel)
cancel_btn.grid(row=2, column=1, sticky=N+E, padx=5, pady=5)
cancel_btn.bind('<Return>', self.cancel)
示例6: _initsearchcondpanel
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
def _initsearchcondpanel(self):
frame = Frame(self)
frame.grid(row=0, column=1, sticky=E + W + S + N, padx=5)
label = Label(frame, text="Search Condition: ")
label.grid(row=0, column=0, columnspan=1, sticky=W)
relationlable = Label(frame, text="Relation")
relationlable.grid(row=0, column=1, columnspan=1, sticky=E)
self.condrelationvar = StringVar(frame)
relationinput = Combobox(frame, textvariable=self.condrelationvar, values=["and", "or"])
relationinput.grid(row=0, column=2, padx=5, sticky=E)
relationinput.bind('<<ComboboxSelected>>', self._onrelationchange)
self.searchcondlist = Listbox(frame)
self.searchcondlist.grid(row=1, rowspan=1, columnspan=3, sticky=E + W + S + N)
vsl = Scrollbar(frame, orient=VERTICAL)
vsl.grid(row=1, column=3, rowspan=1, sticky=N + S + W)
hsl = Scrollbar(frame, orient=HORIZONTAL)
hsl.grid(row=2, column=0, columnspan=3, sticky=W + E + N)
self.searchcondlist.config(yscrollcommand=vsl.set, xscrollcommand=hsl.set)
hsl.config(command=self.searchcondlist.xview)
vsl.config(command=self.searchcondlist.yview)
newbtn = Button(frame, text="New", width=7, command=self._addsearchcondition)
newbtn.grid(row=3, column=0, padx=5, pady=5, sticky=E)
delbtn = Button(frame, text="Delete", width=7, command=self._deletesearchcondition)
delbtn.grid(row=3, column=1, sticky=E)
modbtn = Button(frame, text="Update", width=7, command=self._modifysearchcondition)
modbtn.grid(row=3, column=2, padx=5, pady=5, sticky=W)
示例7: AddDrawingRuleDialog
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
class AddDrawingRuleDialog(d.Dialog):
def body(self, master, existingRule=None):
self.cmd = String()
Label(master, text= "Symbol:").grid(row=0)
Label(master, text= "Rule:" ).grid(row=1)
self.e1 = Input(master, width=20)
self.e2 = Dropdown(master, textvariable= self.cmd, width= 7, state= 'readonly')
self.e3 = Input(master, width=10)
self.e2['values'] = ['draw', 'turn', 'skip', 'back', 'color', 'thick']
self.e1.grid(row=0, column=1, columnspan=2)
self.e2.grid(row=1, column=1)
self.e3.grid(row=1, column=2)
if existingRule:
self.e1.insert(0, existingRule[1])
self.e2.set(existingRule[2])
#self.e2.insert(0, existingRule[2])
if len(existingRule) > 3:
self.e3.insert(0, existingRule[3])
return self.e1
def validate(self):
symb = self.e1.get()
rule = self.e2.get()
param = self.e3.get()
if symb and rule:
symb = symb.strip()
rule = rule.strip()
if param:
return (symb, rule, param)
else:
return (symb, rule)
def apply(self):
r = self.validate()
if r:
self.result = r
示例8: _popupsearchcondwindow
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
def _popupsearchcondwindow(self, index=-1):
if index < 0:
cond = ValueSearchCondition("", "")
else:
cond = self._getselectedfile().searchconds[index]
window = Toplevel(self)
title = Label(window, text="New Search Condition")
title.grid(row=0, column=0, padx=5, pady=5, sticky=W + N)
fieldlabel = Label(window, text="Field Name: ")
fieldlabel.grid(row=1, column=0, padx=5, pady=5, sticky=W)
fields = csvhandler.getfields(self._getselectedfile().filename)
fieldvar = StringVar(window)
fieldinput = Combobox(window, textvariable=fieldvar, values=fields, width=20)
fieldinput.grid(row=1, column=1, columnspan=2, padx=5, pady=5, sticky=W)
valuelabel = Label(window, text="Value: ")
valuelabel.grid(row=3, column=0, padx=5, pady=5, sticky=W)
valueinput = Entry(window)
valueinput.grid(row=3, column=1, columnspan=2, padx=5, pady=5, sticky=W)
minlabel = Label(window, text="Min Value: ")
minlabel.grid(row=4, column=0, padx=5, pady=5, sticky=W)
mininput = Entry(window)
mininput.grid(row=4, column=1, columnspan=2, padx=5, pady=5, sticky=W)
maxlabel = Label(window, text="Max Value: ")
maxlabel.grid(row=5, column=0, padx=5, pady=5, sticky=W)
maxinput = Entry(window)
maxinput.grid(row=5, column=1, columnspan=2, padx=5, pady=5, sticky=W)
sarchkind = IntVar()
def _enablesingle():
valueinput.config(state=NORMAL)
mininput.config(state=DISABLED)
maxinput.config(state=DISABLED)
singlebutton.select()
def _enablejoin():
valueinput.config(state=DISABLED)
mininput.config(state=NORMAL)
maxinput.config(state=NORMAL)
joinbutton.select()
typelabel = Label(window, text="Search Type: ")
typelabel.grid(row=2, column=0, padx=5, pady=5, sticky=W)
singlebutton = Radiobutton(window, text="Single", variable=sarchkind, value=1, command=_enablesingle)
singlebutton.grid(row=2, column=1, columnspan=1, padx=5, pady=5, sticky=W)
joinbutton = Radiobutton(window, text="Range", variable=sarchkind, value=2, command=_enablejoin)
joinbutton.grid(row=2, column=2, columnspan=1, padx=5, pady=5, sticky=W)
# init value
fieldvar.set(cond.field)
if isinstance(cond, ValueSearchCondition):
valueinput.insert(0, cond.val)
_enablesingle()
elif isinstance(cond, RangeSearchCondition):
mininput.insert(0, cond.valmin)
maxinput.insert(0, cond.valmax)
_enablejoin()
def _newcond():
'''create new condition
'''
if sarchkind.get() == 1:
cond = ValueSearchCondition(fieldvar.get(), valueinput.get())
else:
cond = RangeSearchCondition(fieldvar.get(), mininput.get(), maxinput.get())
selectedfile = self._getselectedfile()
if index < 0:
selectedfile.searchconds.append(cond)
else:
del selectedfile.searchconds[index]
selectedfile.searchconds[index:index] = [cond]
self._inflatesearchcondlist(selectedfile)
window.destroy()
okbtn = Button(window, text="Confirm", width=7, command=_newcond)
okbtn.grid(row=6, column=1, rowspan=1, columnspan=1, sticky=E, padx=5, pady=5)
clsbtn = Button(window, text="Close", width=7, command=lambda: window.destroy())
clsbtn.grid(row=6, column=2, rowspan=1, columnspan=1, sticky=E, padx=5, pady=5)
示例9: __init__
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
def __init__(self, master):
Frame.__init__(self, master)
pane = PanedWindow(orient=HORIZONTAL)
leftFrame = LabelFrame(text="Liste des rapports de visite")
# NUMERO
tbNum = Entry(leftFrame, width=24)
tbNum.insert(0, '12') # Hydrater avec les propriétés du rapport
tbNum.config(state='readonly')
Label(leftFrame,
text='Numéro de rapport : ').grid(row=0, column=0, sticky=SE)
tbNum.grid(row=0, column=1, sticky=SE, pady=5)
# PRATICIEN
cbbPraticien = Combobox(leftFrame,
width=22,
values=['Alice', 'Bob', 'Charlie', 'Donald'])
cbbPraticien.set('Alice') # Hydrater avec les propriétés du rapport
cbbPraticien.config(state='disabled')
Label(leftFrame, text='Praticien : ').grid(row=1, column=0, sticky=SE)
cbbPraticien.grid(row=1, column=1, sticky=SE, pady=5)
# DATE
tbDate = Entry(leftFrame, width=24)
tbDate.insert(0, '16/12/2014') # Hydrater avec les propriétés du rapport
tbDate.config(state='readonly')
Label(leftFrame, text='Date : ').grid(row=2, column=0, sticky=SE)
tbDate.grid(row=2, column=1, sticky=SE, pady=5)
# MOTIF
cbbMotif = Combobox(leftFrame, width=22, values=[
'Visite régulière',
'Demande',
'Nouveau produit'])
cbbMotif.set('Visite régulière') # Hydrater avec les propriétés du rapport
cbbMotif.config(state='disabled')
Label(leftFrame, text='Combo : ').grid(row=3, column=0, sticky=SE)
cbbMotif.grid(row=3, column=1, sticky=SE, pady=5)
pane.add(leftFrame)
# BILAN
rightFrame = LabelFrame(text="Bilan : ")
txtBilan = Text(rightFrame, height=6, width=64)
txtBilan.insert(0, 'Bla blabla bla.')
txtBilan.config(state='disabled')
txtBilan.grid(row=4, column=1, pady=5)
# ECHANTILLONS
# TODO
pane.add(rightFrame)
pane.grid(row=0, column=0)
示例10: Menu
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label="Help Index", command=donothing)
helpmenu.add_command(label="About...", command=about)
menubar.add_cascade(label="Help", menu=helpmenu)
root.config(menu=menubar)
filebox = Combobox(root, textvariable=filevar, values=openfiles, state='readonly')
filebox.current(0)
colorbox = Combobox(root, textvariable=colorvar, values=colors, state='readonly')
colorbox.current(0)
label1 = Label(root, textvariable = mode, bg="white", fg="black")
label3 = Label(root, text="vakant", bg="white", fg="black")
draw = Canvas(root, cursor="none", width=WidthHeight[0], height=WidthHeight[1])
draw.bind("<Motion>", functools.partial(motion, objects1=objects, keyes1=keyes, new1=new, arc=arc, WidthHeight=WidthHeight , color=color))
draw.bind("<Button-1>", functools.partial(paint, keyes1=keyes, snapp1=snapp, new1=new, arc=arc))
draw.bind_all("<KeyPress>", keypressed)
filebox.bind("<<ComboboxSelected>>", fileop.changeactive)
colorbox.bind("<<ComboboxSelected>>", fileop.colorset)
filebox.grid(row=0, column=0, columnspan=1, sticky=W+E)
colorbox.grid(row=0, column=1, columnspan=1, sticky=W+E)
draw.grid(row=1, column=0, columnspan=10, sticky=W+E)
label1.grid(row=2, column=0, columnspan=1, sticky=W+E)
label3.grid(row=2, column=2, columnspan=8, sticky=W+E)
root.mainloop()
示例11: EntryVidget
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
#.........这里部分代码省略.........
# Register the validator wrapper with Tkinter. Get reference ID.
self._validator_wrapper_ref_id = \
self.text_widget().winfo_toplevel().register(
self._validator_wrapper
)
# Mount the validator wrapper to the text widget
self._validator_wrapper_mount()
# If the text widget is Combobox
if isinstance(self._text_widget, Combobox):
# Bind selected event to event handler
self._text_widget.bind(
'<<ComboboxSelected>>', self._on_combobox_selected
)
# Cached text
self._text = self._text_widget.get()
# Set initial text
self.text_set(text if text is not None else '', notify=False)
# Update widget
self._widget_update()
def _widget_update(self):
"""
Update widget config and layout.
@return: None.
"""
# Do not use children to compute main frame's geometry
self.widget().grid_propagate(False)
# Configure layout weights for children
self.widget().rowconfigure(0, weight=1)
self.widget().columnconfigure(0, weight=1)
# Lay out the text widget to take all space of the main frame
self._text_widget.grid(
in_=self.widget(),
row=0,
column=0,
sticky='NSEW',
)
def text_widget(self):
"""
Get the text widget.
@return: Text widget.
"""
# Return the text widget
return self._text_widget
def text(self):
"""
Get cached text.
`self._text` and `self._text_widget.get()` usually give same value.
But from within the validator wrapper at 3Q7EB, when the new value is
being validated, the new value is only available in `self._text`.
Tkinter widget's interval value has not been updated yet.
示例12: __init__
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
class mainGUI:
def __init__(self):
root = Tk()
root.wm_title("ThreadCam")
self.threadingVelocityVar = StringVar()
self.groovingVelocityVar = StringVar()
self.pitchToggle = StringVar()
self.threadingToolEntry = {}
self.groovingToolEntry = {}
self.threadDataEntry = {}
self.miscDataEntry = {}
#Menubar
menuBar = Menu(root)
fileMenu = Menu(menuBar, tearoff=0)
fileMenu.add_command(label="Open", command=self.openCommand)
fileMenu.add_command(label="Save", command=self.saveCommand)
fileMenu.add_separator()
fileMenu.add_command(label="Exit", command=root.quit)
menuBar.add_cascade(label="File", menu=fileMenu)
programMenu = Menu(menuBar, tearoff=0)
programMenu.add_command(label="Generate", command=self.generateMenuCommand)
programMenu.add_command(label="Report...", command=self.reportCommand)
menuBar.add_cascade(label="Program", menu=programMenu)
root.config(menu=menuBar)
#End Menubar
#Tool Data Frame
toolDataFrame = Frame()
toolDataFrame.grid(padx=5, row=0, column=0, sticky=EW)
toolDataFrame.columnconfigure(2, weight=1)
label = Label(toolDataFrame, text="Tool Data", font=("Lucida Console bold", 18))
label.grid(row=0, column=0, sticky=W)
self.unitsVar = StringVar()
self.unitsVar.trace('w', self.unitsChange)
self.unitsBox = Combobox(toolDataFrame, state='readonly', width=10, textvar=self.unitsVar)
self.unitsBox['values'] = ('Imperial', 'Metric')
self.unitsBox.current(0)
self.unitsBox.grid(row=0, column=2, sticky=E, padx=5)
separator = Frame(toolDataFrame, height=2, bd=1, relief=SUNKEN)
separator.grid(pady=5, row=1, columnspan=7, sticky=EW)
#Threading Tool Data Frame
threadingToolFrame = Frame(toolDataFrame)
threadingToolFrame.grid(row=2, column=0, sticky=EW)
label = Label(threadingToolFrame, text="Threading Tool", font=("Lucida Console", 14))
label.grid(row=0, column=0, sticky=W)
Label(threadingToolFrame, text="Tool Number") .grid(row=1, column=0, sticky=W)
Label(threadingToolFrame,
textvar=self.threadingVelocityVar) .grid(row=2, column=0, sticky=W)
Label(threadingToolFrame, text="PDX") .grid(row=3, column=0, sticky=W)
Label(threadingToolFrame, text="NAP") .grid(row=4, column=0, sticky=W)
self.threadingToolEntry["toolNumber"] = Entry(threadingToolFrame, width=10)
self.threadingToolEntry["velocity"] = Entry(threadingToolFrame, width=10)
self.threadingToolEntry["PDX"] = Entry(threadingToolFrame, width=10)
self.threadingToolEntry["NAP"] = Entry(threadingToolFrame, width=10)
self.threadingToolEntry["toolNumber"] .grid(row=1, column=1, sticky=W)
self.threadingToolEntry["velocity"] .grid(row=2, column=1, sticky=W)
self.threadingToolEntry["PDX"] .grid(row=3, column=1, sticky=W)
self.threadingToolEntry["NAP"] .grid(row=4, column=1, sticky=W)
separator = Frame(threadingToolFrame, height=0, bd=0, relief=SUNKEN)
separator.grid(padx=5, pady=5, row=5, columnspan=7)
Label(threadingToolFrame, text="Insert ID") .grid(row=6, column=0, sticky=W)
Label(threadingToolFrame, text="Cutting Unit ID") .grid(row=8, column=0, sticky=W)
Label(threadingToolFrame, text="Clamping Unit ID") .grid(row=10, column=0, sticky=W)
self.threadingToolEntry["insertID"] = Entry(threadingToolFrame, width=30)
self.threadingToolEntry["unitID"] = Entry(threadingToolFrame, width=30)
self.threadingToolEntry["clampingID"] = Entry(threadingToolFrame, width=30)
self.threadingToolEntry["insertID"] .grid(row=7, column=0, columnspan=2, sticky=W)
self.threadingToolEntry["unitID"] .grid(row=9, column=0, columnspan=2, sticky=W)
self.threadingToolEntry["clampingID"] .grid(row=11, column=0, columnspan=2, sticky=W)
#End Threading Tool Data Frame
separator = Frame(toolDataFrame, height=2, bd=1, relief=SUNKEN)
separator.grid(padx=10, row=3, column=1)
#Grooving Tool Data Frame
groovingToolFrame = Frame(toolDataFrame)
groovingToolFrame.grid(row=2, column=2, sticky=EW)
label = Label(groovingToolFrame, text="Grooving Tool", font=("Lucida Console", 14))
label.grid(row=0, column=0, sticky=W)
Label(groovingToolFrame, text="Tool Number") .grid(row=1, column=0, sticky=W)
#.........这里部分代码省略.........
示例13: Entry
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
ent_wall_dir_path = Entry(frame0, width=30, bd=3, textvariable=ent_text0)
ent_interval = Entry(frame0, width=5, bd=3, textvariable=ent_text1)
if os.access('/usr/share/wallnext/logo.gif', os.R_OK) == True:
print('Found logo')
img0 = PhotoImage(file="/usr/share/wallnext/logo.gif")
canv0.create_image(0, 0, image=img0, anchor="nw")
else:
print('Warning: no logo')
canv0.grid(row=0, column=0, columnspan=5)
frame0.grid(row=0, column=0)
#lab0.grid(row=0, column=0, columnspan=3)
lab1.grid(row=1, column=0)
combobox_wall_manager.grid(row=1,column=1,columnspan=3)
lab2.grid(row=3, column=0)
ent_wall_dir_path.grid(row=3, column=1, columnspan=3)
but_browse.grid(row=3, column=4)
lab3.grid(row=4, column=0)
ent_interval.grid(row=4, column=1)
read_subdir_cbut.grid(row=4, column=2, columnspan=2)
rbut_sort_random.grid(row=5, column=0)
rbut_sort_name.grid(row=5, column=0, columnspan=4)
rbut_sort_date.grid(row=5, column=1, columnspan=4)
示例14: reactToClick
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
class OptimizerMainWindow:
"""
classdocs
"""
# TODO: change that name
def reactToClick(self, event):
a = AddRestrictionDialog(self)
def __init__(self, optimizer):
# always have a reference to model/controller
self.optimizer = optimizer
# setup main GUI and make stretchable
self.guiRoot = Tk()
self.guiRoot.title("OPTIMIZR")
self.guiRoot.columnconfigure(1, weight=1)
self.guiRoot.rowconfigure(0, weight=1)
# left (settings) and right (sequences) part
self.frameLeft = Frame(self.guiRoot)
self.frameLeft.grid(row=0, column=0, sticky=W + E + N + S)
self.frameLeft.columnconfigure(0, weight=1)
self.frameRight = Frame(self.guiRoot)
self.frameRight.grid(row=0, column=1, sticky=W + E + N + S)
self.frameRight.columnconfigure(0, weight=1)
self.frameRight.rowconfigure(0, weight=1)
self.frameRight.rowconfigure(1, weight=1)
self.frameSpeciesControll = LabelFrame(self.frameLeft, text="Species", pady=10, padx=10)
self.frameSpeciesControll.columnconfigure(1, weight=1)
self.frameOptimizationControll = LabelFrame(self.frameLeft, text="Optimization", pady=10, padx=10)
self.frameRestrictionControll = LabelFrame(self.frameLeft, text="Restriction Enzymes", pady=10, padx=10)
self.frameSpeciesControll.grid(row=0, column=0, sticky=W + E, padx=10, pady=10)
self.frameOptimizationControll.grid(row=1, column=0, sticky=W + E, padx=10, pady=10)
self.frameRestrictionControll.grid(row=2, column=0, sticky=W + E, padx=10, pady=10)
# Species Controll
Label(self.frameSpeciesControll, text="Source:").grid(row=0, column=0)
Label(self.frameSpeciesControll, text="Target:").grid(row=1, column=0)
self.comboSourceSpecies = Combobox(self.frameSpeciesControll, state="readonly")
self.comboSourceSpecies.grid(row=0, column=1, pady=5, sticky="ew")
self.comboTargetSpecies = Combobox(self.frameSpeciesControll, state="readonly")
self.comboTargetSpecies.grid(row=1, column=1, pady=5, sticky="we")
self.buttonSpeciesList = Button(self.frameSpeciesControll, text="Edit Species List")
self.buttonSpeciesList.grid(row=2, column=1, pady=5, sticky="e")
self.comboSourceSpecies.bind("<<ComboboxSelected>>", self.actionOptimizerSettingsChanged)
self.comboTargetSpecies.bind("<<ComboboxSelected>>", self.actionOptimizerSettingsChanged)
# Optimization Controll
Label(self.frameOptimizationControll, text="Optimization Strategy:").grid(row=0, column=0)
self.comboOptimizationStrategy = Combobox(self.frameOptimizationControll, state="readonly")
self.comboOptimizationStrategy.grid(row=0, column=1)
self.comboOptimizationStrategy["values"] = self.optimizer.possibleOptimizationStrategies
self.comboOptimizationStrategy.bind("<<ComboboxSelected>>", self.actionOptimizerSettingsChanged)
# Restriction Enzymes
self.listRestriction = Listbox(self.frameRestrictionControll)
self.listRestriction.grid(row=0, column=0, columnspan=3, pady=5, sticky=W + E)
self.frameRestrictionControll.columnconfigure(0, weight=1)
self.buttonRestricionAdd = Button(self.frameRestrictionControll, text=" + ")
self.buttonRestricionDel = Button(self.frameRestrictionControll, text=" - ")
self.buttonRestricionAdd.grid(row=1, column=1, padx=5)
self.buttonRestricionDel.grid(row=1, column=2, padx=5)
# Source Sequence Frame
self.frameSourceSequence = LabelFrame(self.frameRight, text="Source Sequence", padx=10, pady=10)
self.frameResultSequence = LabelFrame(self.frameRight, text="Result Sequence", padx=10, pady=10)
self.frameSourceSequence.grid(row=0, column=0, sticky="wens", padx=10, pady=10)
self.frameResultSequence.grid(row=1, column=0, sticky="wens", padx=10, pady=10)
self.buttonSourceLoad = Button(self.frameSourceSequence, text=" Load ")
self.textSourceSeq = ScrolledText(self.frameSourceSequence, height=10)
self.buttonSourceLoad.grid(row=0, column=1, sticky="e", pady=5)
self.textSourceSeq.grid(row=1, column=0, columnspan=2, sticky="wens")
self.frameSourceSequence.columnconfigure(0, weight=1)
self.frameSourceSequence.rowconfigure(1, weight=1)
self.textSourceSeq.frame.columnconfigure(1, weight=1)
self.textSourceSeq.frame.rowconfigure(0, weight=1)
self.buttonOptimize = Button(self.frameResultSequence, text=" OPTIMIZE! ")
self.buttonOptimize.bind("<ButtonRelease>", self.actionOptimize)
self.buttonRemoveRestriction = Button(self.frameResultSequence, text=" RESTRICTION-B-GONE! ")
self.buttonRemoveRestriction.bind("<ButtonRelease>", self.actionRemoveRestricion)
self.buttonSaveResult = Button(self.frameResultSequence, text=" Save ")
self.textResultSequence = ScrolledText(self.frameResultSequence, height=10)
self.buttonOptimize.grid(column=0, row=0, pady=5, sticky="w")
self.buttonRemoveRestriction.grid(column=1, row=0, pady=5, padx=10, sticky="w")
self.textResultSequence.grid(row=1, column=0, columnspan=4, sticky="wens")
self.buttonSaveResult.grid(row=2, column=3, pady=5, sticky="e")
self.frameResultSequence.columnconfigure(2, weight=1)
self.frameResultSequence.rowconfigure(1, weight=1)
self.textResultSequence.frame.columnconfigure(1, weight=1)
self.textResultSequence.frame.rowconfigure(0, weight=1)
#.........这里部分代码省略.........
示例15: _popupjoincondwindow
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import grid [as 别名]
def _popupjoincondwindow(self, index=-1):
if index < 0:
cond = JoinSearchCondition(("", ""))
tofilename = ""
else:
condtuple = self._getselectedfile().joincondtuples[index]
cond = condtuple[0]
tofilename = condtuple[1]
window = Toplevel(self)
title = Label(window, text="New Search Condition")
title.grid(row=0, column=0, padx=5, pady=5, sticky=W + N)
filenamelabel = Label(window, text="Target Field Name: ")
filenamelabel.grid(row=1, column=0, padx=5, pady=5, sticky=W)
filevar = StringVar(window)
filenameinput = Combobox(window, textvariable=filevar, values=self.filelist.get(0, END), width=30)
filenameinput.grid(row=1, column=1, columnspan=2, padx=5, pady=5, sticky=W)
fromfieldlabel = Label(window, text="Field in From File: ")
fromfieldlabel.grid(row=3, column=0, padx=5, pady=5, sticky=W)
fromfields = csvhandler.getfields(self._getselectedfile().filename)
fromfieldvar = StringVar(window)
fieldinput = Combobox(window, textvariable=fromfieldvar, values=fromfields, width=20)
fieldinput.grid(row=3, column=1, columnspan=2, padx=5, pady=5, sticky=W)
tofieldlabel = Label(window, text="Field in Target File: ")
tofieldlabel.grid(row=4, column=0, padx=5, pady=5, sticky=W)
tofields = []
tofieldvar = StringVar(window)
tofieldinput = Combobox(window, textvariable=tofieldvar, values=tofields, width=20)
tofieldinput.grid(row=4, column=1, columnspan=2, padx=5, pady=5, sticky=W)
def updatetofieldinput(evt):
if filevar.get() is not None and len(filevar.get()) > 0:
tofields = csvhandler.getfields(filevar.get())
window.grid_slaves(4, 1)[0].grid_forget()
tofieldinput = Combobox(window, textvariable=tofieldvar, values=tofields, width=20)
tofieldinput.grid(row=4, column=1, columnspan=2, padx=5, pady=5, sticky=W)
filenameinput.bind('<<ComboboxSelected>>', updatetofieldinput)
# init value
filevar.set(tofilename)
fromfieldvar.set(cond.fieldtuple[0])
updatetofieldinput(None)
tofieldvar.set(cond.fieldtuple[1])
def _newcond():
'''create new condition
'''
cond = JoinSearchCondition((fromfieldvar.get(), tofieldvar.get()))
tofilename = filevar.get()
selectedfile = self._getselectedfile()
if index < 0:
selectedfile.joincondtuples.append((cond, tofilename))
else:
del selectedfile.joincondtuples[index]
selectedfile.joincondtuples[index:index] = [(cond, tofilename)]
self._inflatejoincondlist(selectedfile.joincondtuples)
window.destroy()
okbtn = Button(window, text="Confirm", width=7, command=_newcond)
okbtn.grid(row=6, column=1, rowspan=1, columnspan=1, sticky=E, padx=5, pady=5)
clsbtn = Button(window, text="Close", width=7, command=lambda: window.destroy())
clsbtn.grid(row=6, column=2, rowspan=1, columnspan=1, sticky=W, padx=5, pady=5)