本文整理汇总了Python中ttk.Combobox.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.configure方法的具体用法?Python Combobox.configure怎么用?Python Combobox.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Combobox
的用法示例。
在下文中一共展示了Combobox.configure方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SolinetteGUI
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import configure [as 别名]
class SolinetteGUI(Tk):
def __init__(self):
# basics settings
Tk.__init__(self) # constructor of parent graphic class
self.title(u'Solinette: geolocalizar direcciones en Lima y Callo')
self.iconbitmap('icone_Solinette.ico')
self.resizable(width = False, height = False)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
# Frames
self.FrPath = LabelFrame(self, name ='primero',
text = u'1: las direcciones para geolocalizar',
padx = 5, pady = 5)
self.FrAttr = LabelFrame(self, name ='segundo',
text = u'2: columnas indispensables',
padx = 5, pady = 5)
self.FrConn = LabelFrame(self, name ='tercero',
text = u'3: parámetros de conexión a la base de datos',
padx=5, pady=5)
# Variables
inutile = ['Esperando que se elige el archivo Excel']
self.typcols = []
self.host = StringVar()
self.port = IntVar()
self.dbnb = StringVar()
self.usua = StringVar()
self.mdpa = StringVar()
self.ok = 0
self.dico_cols = OD()
self.dico_vals = OD()
self.dico_param = {}
## Frame 1
# target folder
labtarg = Label(self.FrPath, text = u'Archivo Excel (.xls): ')
self.target = Entry(self.FrPath, width = 35)
self.browsetarg = Button(self.FrPath,
text = 'Explorar',
command = self.setpathtarg)
# widgets placement
labtarg.grid(row = 1, column = 1, columnspan = 1, sticky = N+S+W+E, padx = 2, pady = 2)
self.target.grid(row = 1, column = 2, columnspan = 1, sticky = N+S+W+E, padx = 2, pady = 2)
self.browsetarg.grid(row = 1, column = 3, columnspan = 1, sticky = N+S+W+E, padx = 2, pady = 2)
## Frame 2
# Drop-down lists of columns
labdir = Label(self.FrAttr, text = u'Columna dirección: ')
self.ddl_dir = Combobox(self.FrAttr, values = inutile)
labdis = Label(self.FrAttr, text = u'Columna distrito: ')
self.ddl_dis = Combobox(self.FrAttr, values = inutile)
# nombre de la tabla en PostgreSQL
labtabl = Label(self.FrAttr, text = u'Nombre de la tabla: ')
self.tabl = Entry(self.FrAttr, width = 35)
# widgets placement
labdir.grid(row = 1, column = 1, sticky = N+S+W, padx = 2, pady = 2)
self.ddl_dir.grid(row = 1, column = 2, sticky = N+S+W+E, padx = 2, pady = 2)
labdis.grid(row = 2, column = 1, sticky = N+S+W, padx = 2, pady = 2)
self.ddl_dis.grid(row = 2, column = 2, sticky = N+S+W+E, padx = 2, pady = 2)
labtabl.grid(row = 3, column = 1, sticky = N+S+W, padx = 2, pady = 2)
self.tabl.grid(row = 3, column = 2, sticky = N+S+W+E, padx = 2, pady = 2)
## Frame 3
# Etiquetas
Label(self.FrConn, text = u'Host: ').grid(row = 1, column = 1,
padx = 2, pady = 2,
sticky = N+S+W)
Label(self.FrConn, text = u'Puerto: ').grid(row = 2, column = 1,
padx = 2, pady = 2,
sticky = N+S+W)
Label(self.FrConn, text = u'Base de datos: ').grid(row = 3,
column = 1,
padx = 2,
pady = 2,
sticky = N+S+W)
Label(self.FrConn, text = u'Usuario: ').grid(row = 4,
column = 1,
padx = 2,
pady = 2,
sticky = N+S+W)
Label(self.FrConn, text = u'Contraseña: ').grid(row = 5,
column = 1,
padx = 2,
pady = 2,
sticky = N+S+W)
# Formulario
self.H = Entry(self.FrConn, textvariable = self.host)
self.P = Entry(self.FrConn, textvariable = self.port)
self.D = Entry(self.FrConn, textvariable = self.dbnb)
self.U = Entry(self.FrConn, textvariable = self.usua)
self.M = Entry(self.FrConn, textvariable = self.mdpa, show='*')
# pre relleno
self.host.set('localhost')
self.port.set('5432')
#.........这里部分代码省略.........
示例2: MainFrame
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import configure [as 别名]
class MainFrame(Frame):
def __init__(self,parent,stdoutq):
Frame.__init__(self,parent)
self.parent=parent
self.width=700
self.height=400
self.title='Menotexport v1.0'
self.stdoutq=stdoutq
self.initUI()
self.hasdb=False
self.hasout=False
self.hasaction=False
self.exit=False
self.path_frame=self.addPathFrame()
self.action_frame=self.addActionFrame()
self.message_frame=self.addMessageFrame()
self.printStr()
self.stateq=Queue.Queue()
#self.workproc=Pool(1)
def centerWindow(self):
sw=self.parent.winfo_screenwidth()
sh=self.parent.winfo_screenheight()
x=(sw-self.width)/2
y=(sh-self.height)/2
self.parent.geometry('%dx%d+%d+%d' \
%(self.width,self.height,x,y))
def initUI(self):
self.parent.title(self.title)
self.style=Style()
#Choose from default, clam, alt, classic
self.style.theme_use('alt')
self.pack(fill=tk.BOTH,expand=True)
self.centerWindow()
def printStr(self):
while self.stdoutq.qsize() and self.exit==False:
try:
msg=self.stdoutq.get()
self.text.update()
self.text.insert(tk.END,'# '+msg)
self.text.see(tk.END)
except Queue.Empty:
pass
self.after(100,self.printStr)
def checkReady(self):
if self.isexport.get()==1 or self.ishighlight.get()==1\
or self.isnote.get()==1:
self.hasaction=True
else:
self.hasaction=False
if self.hasdb and self.hasout and self.hasaction:
self.start_button.configure(state=tk.NORMAL)
print('Menotexport Ready.')
else:
self.start_button.configure(state=tk.DISABLED)
def addPathFrame(self):
frame=Frame(self)
frame.pack(fill=tk.X,expand=0,side=tk.TOP,padx=8,pady=5)
frame.columnconfigure(1,weight=1)
#------------------Database file------------------
label=tk.Label(frame,text='Mendeley Data file:',\
bg='#bbb')
label.grid(row=0,column=0,\
sticky=tk.W,padx=8)
self.db_entry=tk.Entry(frame)
self.db_entry.grid(row=0,column=1,sticky=tk.W+tk.E,padx=8)
self.db_button=tk.Button(frame,text='Open',command=self.openFile)
self.db_button.grid(row=0,column=2,padx=8,sticky=tk.E)
hint='''
Default location on Linux:
~/.local/share/data/Mendeley\ Ltd./Mendeley\ Desktop/[email protected]
Default location on Windows:
C:\Users\Your_name\AppData\Local\Mendeley Ltd\Mendeley Desktop\[email protected]'''
hint_label=tk.Label(frame,text=hint,\
justify=tk.LEFT,anchor=tk.NW)
hint_label.grid(row=1,column=0,columnspan=3,\
sticky=tk.W,padx=8)
#.........这里部分代码省略.........
示例3: MainFrame
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import configure [as 别名]
class MainFrame(Frame):
def __init__(self,parent,stdoutq):
Frame.__init__(self,parent)
self.parent=parent
self.width=750
self.height=450
self.title=ximaexport.__version__
self.stdoutq=stdoutq
self.initUI()
self.hasdb=False
self.hasout=False
self.exit=False
self.path_frame=self.addPathFrame()
self.action_frame=self.addActionFrame()
self.message_frame=self.addMessageFrame()
self.printStr()
self.stateq=Queue.Queue()
def centerWindow(self):
sw=self.parent.winfo_screenwidth()
sh=self.parent.winfo_screenheight()
x=(sw-self.width)/2
y=(sh-self.height)/2
self.parent.geometry('%dx%d+%d+%d' \
%(self.width,self.height,x,y))
def initUI(self):
self.parent.title(self.title)
self.style=Style()
#Choose from default, clam, alt, classic
self.style.theme_use('alt')
self.pack(fill=tk.BOTH,expand=True)
self.centerWindow()
def printStr(self):
while self.stdoutq.qsize() and self.exit==False:
try:
msg=self.stdoutq.get()
self.text.update()
self.text.insert(tk.END,msg)
self.text.see(tk.END)
except Queue.Empty:
pass
self.after(100,self.printStr)
def checkReady(self):
if self.hasdb and self.hasout:
self.start_button.configure(state=tk.NORMAL)
#print('XimaExport Ready.')
printch('XimaExport 就绪.')
else:
self.start_button.configure(state=tk.DISABLED)
def addPathFrame(self):
frame=Frame(self)
frame.pack(fill=tk.X,expand=0,side=tk.TOP,padx=8,pady=5)
frame.columnconfigure(1,weight=1)
#------------------Database file------------------
label=tk.Label(frame,text=dgbk('ting.sqlite文件:'),\
bg='#bbb')
label.grid(row=0,column=0,\
sticky=tk.W,padx=8)
self.db_entry=tk.Entry(frame)
self.db_entry.grid(row=0,column=1,sticky=tk.W+tk.E,padx=8)
self.db_button=tk.Button(frame,text=dgbk('打开'),command=self.openFile)
self.db_button.grid(row=0,column=2,padx=8,sticky=tk.E)
#--------------------Output dir--------------------
label2=tk.Label(frame,text=dgbk('导出到文件夹:'),\
bg='#bbb')
label2.grid(row=2,column=0,\
sticky=tk.W,padx=8)
self.out_entry=tk.Entry(frame)
self.out_entry.grid(row=2,column=1,sticky=tk.W+tk.E,padx=8)
self.out_button=tk.Button(frame,text=dgbk('选择'),command=self.openDir)
self.out_button.grid(row=2,column=2,padx=8,sticky=tk.E)
def openDir(self):
self.out_entry.delete(0,tk.END)
dirname=askdirectory()
self.out_entry.insert(tk.END,dirname)
#.........这里部分代码省略.........
示例4: Example
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import configure [as 别名]
#.........这里部分代码省略.........
id = -1
guardar = TRUE
# Creamos una ventana nueva
t = Toplevel(self)
t.wm_title("Crear Voluntario")
# Etiqueta y entrada de nombre
Label(t, text="Nombre").grid(row=0)
entradaNombre = Entry(t)
entradaNombre.grid(row=0, column=1,sticky = "ew")
# Etiqueta y entrada de apellidos
Label(t, text="Apellidos").grid(row=1)
entradaApellidos = Entry(t)
entradaApellidos.grid(row=1, column=1,sticky = "ew")
# Etiqueta y entrada de DNI
Label(t, text="DNI").grid(row=2)
entradaDNI = Entry(t)
entradaDNI.grid(row=2, column=1,sticky = "ew")
# Etiqueta y entrada de Dirreccion
Label(t, text="Direccion").grid(row=3)
entradaDireccion = Entry(t)
entradaDireccion.grid(row=3, column=1)
# Etiqueta y seleccion de Estudios
Label(t, text="Estudios").grid(row=4)
box_value = StringVar()
self.getEstudios()
self.selectorEstudios = Combobox(t, textvariable=box_value, state='readonly')
self.selectorEstudios['values'] = self.listadoEstudios[0]
self.selectorEstudios.configure(width=25)
self.selectorEstudios.current(0)
self.selectorEstudios.grid(row=4, column=1)
botonEditarEstudios = Button(t, text="Editar", command=self.editarEstudio)
botonNuevosEstudios = Button(t, text="Nuevo", command=self.nuevoEstudio)
botonEditarEstudios.grid(row=4, column=2)
botonNuevosEstudios.grid(row=4, column=3)
# Etiqueta y seleccion de Genero
Label(t, text="Genero").grid(row=5)
seleccionGenero = Combobox(t, values=["Masculino (M)", "Femenino (F)"], state='readonly')
seleccionGenero.grid(row=5, column=1)
# Etiqueta y seleccion de Parroquial
Label(t, text="Parroquial").grid(row=6)
box_value = StringVar()
self.getParroquial()
self.selectorParroquial = Combobox(t, textvariable=box_value, state='readonly')
self.selectorParroquial['values'] = self.listadoParroquial[0]
self.selectorParroquial.configure(width=25)
self.selectorParroquial.current(0)
self.selectorParroquial.grid(row=6, column=1)
botonEditarParroquial = Button(t, text="Editar", command=self.editarParroquia)
botonNuevaParroqual = Button(t, text="Nuevo", command=self.nuevaParroquia)
botonEditarParroquial.grid(row=6, column=2)
botonNuevaParroqual.grid(row=6, column=3)
# Etiqueta y seleccion de Correo
Label(t, text="Correo").grid(row=0, column=4)
entradaCorreo = Entry(t)
entradaCorreo.grid(row=0, column=5)
示例5: MainFrame
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import configure [as 别名]
class MainFrame(Frame):
def __init__(self,parent,stdoutq):
Frame.__init__(self,parent)
self.parent=parent
self.width=850
self.height=650
self.title=menotexport.__version__
self.stdoutq=stdoutq
self.initUI()
self.hasdb=False
self.hasout=False
self.hasaction=False
self.exit=False
self.path_frame=self.addPathFrame()
self.action_frame=self.addActionFrame()
self.message_frame=self.addMessageFrame()
self.printStr()
self.stateq=Queue.Queue()
#self.workproc=Pool(1)
def centerWindow(self):
sw=self.parent.winfo_screenwidth()
sh=self.parent.winfo_screenheight()
x=(sw-self.width)/2
y=(sh-self.height)/2
self.parent.geometry('%dx%d+%d+%d' \
%(self.width,self.height,x,y))
def initUI(self):
self.parent.title(self.title)
self.style=Style()
#Choose from default, clam, alt, classic
self.style.theme_use('alt')
self.pack(fill=tk.BOTH,expand=True)
self.centerWindow()
def printStr(self):
while self.stdoutq.qsize() and self.exit==False:
try:
msg=self.stdoutq.get()
self.text.update()
self.text.insert(tk.END,msg)
self.text.see(tk.END)
except Queue.Empty:
pass
self.after(100,self.printStr)
def checkReady(self):
if self.isexport.get()==1 or self.ishighlight.get()==1\
or self.isnote.get()==1 or self.isbib.get()==1:
self.hasaction=True
else:
self.hasaction=False
if self.hasdb and self.hasout and self.hasaction:
self.start_button.configure(state=tk.NORMAL)
print('# <Menotexport>: Menotexport Ready.')
else:
self.start_button.configure(state=tk.DISABLED)
def addPathFrame(self):
frame=Frame(self)
frame.pack(fill=tk.X,expand=0,side=tk.TOP,padx=8,pady=5)
frame.columnconfigure(1,weight=1)
#------------------Database file------------------
label=tk.Label(frame,text='Mendeley Data file:',\
bg='#bbb')
label.grid(row=0,column=0,\
sticky=tk.W,padx=8)
self.db_entry=tk.Entry(frame)
self.db_entry.grid(row=0,column=1,sticky=tk.W+tk.E,padx=8)
self.db_button=tk.Button(frame,text='Open',command=self.openFile)
self.db_button.grid(row=0,column=2,padx=8,sticky=tk.E)
hint='''
Default location on Linux:
~/.local/share/data/Mendeley\ Ltd./Mendeley\ Desktop/[email protected]
Default location on Windows:
C:\Users\Your_name\AppData\Local\Mendeley Ltd\Mendeley Desktop\[email protected]'''
hint_label=tk.Label(frame,text=hint,\
justify=tk.LEFT,anchor=tk.NW)
hint_label.grid(row=1,column=0,columnspan=3,\
sticky=tk.W,padx=8)
#.........这里部分代码省略.........
示例6: IniGenGui
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import configure [as 别名]
class IniGenGui(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.inigen = IniGen()
self.initUIGlobals()
def initUIGlobals(self):
"""
This is the first part of the window to be rendered. After these have been
set by the user and 'Emit Globals' has been clicked, the given algorithm
can then specify how to generate the second part of the window. All fields
are disabled for user input after globals have been emitted.
Information in Global Parameters:
Algorithm
- name of the algorithm to use
File Name
- name of the output file to be generated
Min Time
- Minimum Time for distillers to run
Max Time
- Maximum Time for distillers to run
Set Enabled:
- checkbox to specify if the distiller should be enabled True or False
"""
self.parent.title("Ini Generator")
Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10')
# initialize row counter. This is incremented after each element added to grid
row = 0
# initialize column counter. This is incremented after a column has been filled
self.column = 0
# Globals: entries for info common to all runs
label_globals = Label(self, text="Globals")
label_globals.grid(row=row, column=self.column)
row += 1
label_alg = Label(self, text="Algorithm")
label_alg.grid(row=row, column=self.column, sticky=E+W)
row += 1
self.cbox_alg = Combobox(self, values=algorithms.keys(), state='readonly')
self.cbox_alg.current(0)
self.cbox_alg.grid(row=row, column=self.column, sticky=E+W+S+N)
row += 1
label_filename = Label(self, text="Output File Name")
label_filename.grid(row=row, column=self.column, sticky=E+W)
row += 1
self.entry_filename = Entry(self)
self.entry_filename.grid(row=row, column=self.column, sticky=W+E)
row += 1
label_mintime = Label(self, text="Min Time")
label_mintime.grid(row=row, column=self.column, sticky=E+W)
row += 1
self.entry_mintime = Entry(self)
self.entry_mintime.grid(row=row, column=self.column, sticky=W+E)
row += 1
label_maxtime = Label(self, text="Max Time")
label_maxtime.grid(row=row, column=self.column, sticky=W+E)
row += 1
self.entry_maxtime = Entry(self)
self.entry_maxtime.grid(row=row, column=self.column, sticky=W+E)
row += 1
self.enabled = IntVar()
self.check_enabled = Checkbutton(self, text="set enabled", variable=self.enabled)
self.check_enabled.grid(row=row, column=self.column, sticky=W+E)
row += 1
# Control: buttons used to emmiting text and generating file
self.button_emit_globals = Button(self, text="Emit Globals", command=self.emit_globals)
self.button_emit_globals.grid(row=row, column=self.column, sticky=W+E)
row += 1
button_addrun = Button(self, text="Add Run", command=self.emit_run)
button_addrun.grid(row=row, column=self.column, sticky=W+E)
row += 1
button_generate = Button(self, text="Generate File", command=self.generate_file)
button_generate.grid(row=row, column=self.column, sticky=W+E)
row += 1
self.column += 1
self.pack()
def initUIRuns(self):
"""
Second part of gui to be rendered. This contains all the fields needed to emit
a single run within a distiller file. Multiple runs can be added by clicking
'Add Run' multiple times.
Information in Run Parameters:
#.........这里部分代码省略.........