本文整理汇总了Python中ttk.Combobox.pack方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.pack方法的具体用法?Python Combobox.pack怎么用?Python Combobox.pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Combobox
的用法示例。
在下文中一共展示了Combobox.pack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ComboBox
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class ComboBox(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
self.speed = 1.0
def initUI(self):
self.parent.title("Combobox")
self.pack(fill = BOTH, expand=True)
frame = Frame(self)
frame.pack(fill=X)
field = Label(frame, text = "Typing Speed:", width = 15)
field.pack(side = LEFT, padx = 5, pady = 5)
self.box_value = StringVar()
self.box = Combobox(frame, textvariable=self.box_value, width = 5)
self.box['values'] = ('1x', '2x', '5x', '10x' )
self.box.current(0)
self.box.pack(fill = X, padx =5, expand = True)
self.box.bind("<<ComboboxSelected>>", self.value)
def value(self,event):
self.speed = float(self.box.get()[:-1])
示例2: SnapFrame
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class SnapFrame(Frame):
def __init__(self, parent, cb=dummy):
Frame.__init__(self, parent)
self.parent = parent
self.cb = cb
self._init_ui()
def _cb(self, *args):
self.cb(SNAP_DICT[self._var.get()])
def _init_ui(self):
self._var = StringVar()
self.snap_combobox = Combobox(
self, values=SNAP_DICT.keys(),
width=5, textvariable=self._var,
state='readonly')
self.snap_combobox.set(SNAP_DICT.keys()[0])
self._var.trace('w', self._cb)
self.snap_label = Label(self, text='Snap')
self.snap_label.pack(side=LEFT)
self.snap_combobox.pack(side=LEFT)
示例3: JournalEntry
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class JournalEntry(LabelFrame):
def __init__(self, parent, question, i, defaultanswer, *options):
LabelFrame.__init__(self, parent, text=question, padx=5, pady=5)
self.var = StringVar(parent)
try:
if defaultanswer in options:
options = tuple(x for x in options if x != defaultanswer)
options = (defaultanswer,) + options
self.var.set(options[0])
except IndexError:
self.var.set("")
self.om = Combobox(self, textvariable=self.var)
self.om['values'] = options
self.om.pack(padx=5,pady=5, side="left")
self.grid(row=i,column=0,columnspan=3, sticky=W, pady=10)
示例4: PreferencesDialog
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class PreferencesDialog(Dialog):
def __init__(self, parent, title, font, size):
self._master = parent
self.result = False
self.font = font
self.size = size
Dialog.__init__(self, parent, title)
def body(self, master):
self._npFrame = LabelFrame(master, text='Annotation window text')
self._npFrame.pack(fill=X)
self._fontFrame = Frame(self._npFrame, borderwidth=0)
self._fontLabel = Label(self._fontFrame, text='Font:', width=5)
self._fontLabel.pack(side=LEFT, padx=3)
self._fontCombo = Combobox(self._fontFrame, values=sorted(families()),
state='readonly')
self._fontCombo.pack(side=RIGHT, fill=X)
self._sizeFrame = Frame(self._npFrame, borderwidth=0)
self._sizeLabel = Label(self._sizeFrame, text='Size:', width=5)
self._sizeLabel.pack(side=LEFT, padx=3)
self._sizeCombo = Combobox(self._sizeFrame, values=range(8,15),
state='readonly')
self._sizeCombo.pack(side=RIGHT, fill=X)
self._fontFrame.pack()
self._sizeFrame.pack()
self._npFrame.pack(fill=X)
self._fontCombo.set(self.font)
self._sizeCombo.set(self.size)
def apply(self):
self.font = self._fontCombo.get()
self.size = self._sizeCombo.get()
self.result = True
def cancel(self, event=None):
if self.parent is not None:
self.parent.focus_set()
self.destroy()
示例5: PCombobox
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class PCombobox(Frame, PConfig):
def __init__(self, master=None, combobox_callback=None):
Frame.__init__(self, master=master)
self.__cb_stringvar = StringVar()
self.__combobox = Combobox(
master=self, textvariable=self.__cb_stringvar)
if combobox_callback and callable(combobox_callback):
self.__cb_stringvar.trace('w', self.__combobox_chang)
self.__user_call_back = combobox_callback
self.__combobox.pack()
def set_choices(self, choices=[]):
if isinstance(choices, list):
self.__combobox['values'] = choices
else:
self.__combobox['values'] = []
def set_text_aliagen(self, aliagn='left'):
if isinstance(aliagn, str) and aliagn in ['left', 'center', 'right']:
self.__combobox['justify'] = aliagn
else:
raise IllegalArugments, aliagn
def get_select_string(self):
return self.__cb_stringvar.get()
def set_select_string(self, msg):
if msg and (isinstance(msg, str) or isinstance(msg, unicode)):
self.__cb_stringvar.set(msg)
else:
raise IllegalArugments, msg
def __combobox_chang(self, *args):
if self.__user_call_back:
self.__user_call_back(self.get_select_string(), *args)
示例6: __init__
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
#VARIABLES GLOBALES
global cod, cc, inquilino, codinm, inmueble, nit, owner, rel, vlrenta, duracion
global contratos, tcontrato, incremento, gfacturaIni, facturaSgte, fecha, hoy
global notas, anexos, destinacion, servicios, conexos, tercero, nombret, fecha
global aplicado, cc_aplicado, n_aplicado, inm_aplicado, novedad, n_nombre, n_valor
global h, busqueda, clean, update, add
#INSTANCIEAS DE LOS WIDGETS
global e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, Cbx1, chkb1, chkb2, lb, cedulaE, notas
fecha = datetime.date.today()
hoy = "%s" %fecha #ESTE NUESTRA LA FECHA EN FORMATO AÑO-MES-DIA (YYYY/MM/DD)
#hoy = time.strftime("%d/%m/%y") #ESTO PARA VER FORMATO FECHA EN DIA/MES/AÑO
#hoy = time.strftime("%y/%m/%d")
h = hoy
#VARIABLES
lupa = PhotoImage(file='img/lupa.png')
schedule = PhotoImage(file='img/calendar.gif')
cod = IntVar()
cc = StringVar()
inquilino = StringVar()
codinm = IntVar()
inmueble = StringVar()
nit = StringVar()
owner = StringVar()
rel = IntVar()
vlrenta = DoubleVar()
duracion = IntVar()
contratos = ['Vivienda', 'Comercial', 'Mixta']
tcontrato = StringVar()
incremento = DoubleVar()
gfacturaIni = IntVar()
facturaSgte = IntVar()
fecha = StringVar()
notas = StringVar()
anexos = StringVar()
destinacion = StringVar()
servicios = StringVar()
conexos = StringVar()
tercero = StringVar()
nombret = StringVar()
aplicado = IntVar()
cc_aplicado = StringVar()
n_aplicado = StringVar()
inm_aplicado = StringVar()
novedad = StringVar()
n_nombre = StringVar()
n_valor = DoubleVar()
#BUSQUEDA = ["Nombre","CC/Nit"]
busqueda = StringVar()
busqueda.trace("w", lambda name, index, mode: buscar())
dato = StringVar()
#WIDGETS
#========================= HEADER ===========================
self.header = Label(self, text="CONTRATOS", font="bold")
self.header.pack(pady=20, side=TOP)
#========================== WRAPPER ==========================
self.wrapper = Frame (self)
self.wrapper.pack(side=LEFT, fill=Y)
#================ NOTEBOOK =============>
self.nb = Notebook(self.wrapper)
#-----------------------> TAB 1
self.tab1 = Frame (self.nb)
self.f0 = Frame(self.tab1)#-------------------------------------
self.f0.pack(pady=5,fill=X)
l1 = Label(self.f0, text='Código:')
l1.pack(side=LEFT)
e1 = Entry(self.f0, textvariable=cod, width=10)
e1.pack(side=LEFT)
self.f1 = Frame(self.tab1)#-------------------------------------
self.f1.pack(pady=5,fill=X)
l2 = Label(self.f1, text='Arrendatario:')
l2.pack(side=LEFT, fill=X)
e2 = Entry(self.f1, textvariable=cc, width=15)
e2.pack(side=LEFT)
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
#INSTANCIAS
global cc, nombre, pago, ref, cod, desc, valor, resultado, total, tiempo, mes, anio, fechapago
#INSTANCIAS DE LOS WIDGETS
global e1, e2, e3, e4, e5, tree, l8, lb
cc = IntVar()
nombre = StringVar()
pago = StringVar()
ref = StringVar()
cod = StringVar()
desc = StringVar()
valor = DoubleVar()
tiempo = datetime.date.today()
anio = time.strftime("%Y")
mes = time.strftime("%B")
fechapago = StringVar()
total = 0.0
resultado = DoubleVar()
tbancos = ['Bancolombia', "Banco Bogotá", "Banco Agrario", "Banco Occidente"]
lupa = PhotoImage(file='img/lupa.png')
tbanktype = ['Corriente','Ahorro']
fpago = ['Efectivo','Transferencia']
#BUSQUEDA = ["Nombre","CC/Nit"]
busqueda = StringVar()
busqueda.trace("w", lambda name, index, mode: buscar())
dato = StringVar()
#WIDGETS
#========================= HEADER ==============================
self.titleL = Label(self, text="GASTOS", font="bold")
self.titleL.pack(pady=20, side=TOP)
#========================== WRAPPER ============================
self.wrapper = Frame (self)
self.wrapper.pack(side=LEFT, fill=Y)
#Esto centro el wrapper
#self.wrapper.pack(side=LEFT, fill=BOTH, expand=True)
#======================== BENEFICIARIO =======================
self.lf1 = LabelFrame(self.wrapper, text="Beneficiario")
self.lf1.pack(fill=X, ipady=5)
self.f0 = Frame(self.lf1)
self.f0.pack(pady=5, fill=X)#-----------------------------------
l1 = Label(self.f0, text='CC/Nit:')
l1.pack(side=LEFT)
e1 = Entry(self.f0, textvariable=cc)
e1.pack(side=LEFT)
e1.bind('<Return>', buscarB)
b0 = Button(self.f0, text='Buscar:', image=lupa, command=topBeneficiarios)
b0.pack(side=LEFT)
l2 = Label(self.f0, text='Nombre:')
l2.pack(side=LEFT)
e2 = Entry(self.f0, textvariable=nombre)
e2.pack(side=LEFT, fill=X, expand=1)
self.f1 = Frame(self.lf1)
self.f1.pack(pady=5, fill=X)#-----------------------------------
l3 = Label(self.f1, text='Forma de Pago:')
l3.pack(side=LEFT)
Cbx = Combobox(self.f1, textvariable=pago, values=fpago, width=15)
Cbx.set('Efectivo')
Cbx.pack(side=LEFT)
l4 = Label(self.f1, text='Ref. Bancaria:')
l4.pack(side=LEFT)
e3 = Entry(self.f1, textvariable=ref)
e3.pack(side=LEFT, fill=X, expand=1)
b1 = Button(self.f1, text='Buscar:', image=lupa)
b1.image=lupa
b1.pack(side=LEFT)
#======================== CONCEPTO ========================
self.lf2 = LabelFrame(self.wrapper, text="Concepto")
self.lf2.pack(fill=X, ipady=5)
self.f2 = Frame(self.lf2)
self.f2.pack(pady=5, fill=X)#-------------------------------
l5 = Label(self.f2, text='Código:')
#.........这里部分代码省略.........
示例8: Label
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
msg.pack(side = "left", pady =30 )
#===========================================================================
""" From Label"""
Label(f1, text="From",bg="white", fg = "navy blue", anchor="w", font=('Lucida Sans Typewriter',(15))).pack(side = LEFT,
padx = 10,
pady = 20)
""" Como box for "From/ source" """
From = StringVar()
Values = ["Bangalore", "Delhi", "Mumbai", "Chennai"]
w = Combobox(f1,values = Values,width = 15, height = 4, textvariable= From)
w.bind('<<ComboboxSelected>>', Fromcall)
w.pack(side = LEFT, padx = 10, pady = 20)
""" TO Label"""
Label(f1, text="To",bg="white", fg = "navy blue",font=('Lucida Sans Typewriter',(15))).pack(side = LEFT,padx = 10, pady = 20)
""" Como box for "To/Destination" """
To = StringVar()
Values = ["Bangalore", "Delhi", "Mumbai", "Chennai", "Kolkata", "Cochin"]
w = Combobox(f1,values = Values,width = 15, height = 4, textvariable= To)
w.bind('<<ComboboxSelected>>', Tocall)
w.pack(side = LEFT, padx = 10, pady = 20)
#===========================================================================
开发者ID:anusha-vijaykumar,项目名称:Prognosticting_Airfares_using_RandomForests,代码行数:32,代码来源:GenericFlightContinuTreeNext.py
示例9: CompareTime
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
def CompareTime():
global InputDate , HeadderRows, DateLoc
TestPlanFileLocation = GetWorkSheet()
HeadderRows = 4
now = datetime.datetime.now()
## print "Current date and time using str method of datetime object:"
## print str(now)
## print "Current date and time using instance attributes:"
years =str(now.year)
months = str(now.month)
days = str(now.day)
print "Current year: %s" % years
print "Current month: %s" % months
print "Current day: %s" % days
print "%s" %Day
print Month
print Year
if (int(Day) < int(days)) or (int(Month) < int(months)):
tkMessageBox.showerror("Error", "Wrong input")
else:
InputDate = "a " + Day + "/" + Month + "/" + Year
print InputDate
Test_Workbook = xlrd.open_workbook(TestPlanFileLocation)
Test_Worksheet = Test_Workbook.sheet_by_name(SheetName)
Test_Nrows = Test_Worksheet.nrows
print 'Test_Nrows = ',Test_Nrows
Test_Ncols = Test_Worksheet.ncols
DateCount = 0
DateLoc = []
for i in range(HeadderRows,Test_Nrows):
#print "enter1"
Date = Test_Worksheet.cell_value(i,5)
print "date = ",Date
if Date == InputDate:
print "match"
DateCount += 1
DateLoc.append(i)
print "DateLoc = ", DateLoc
print "DateCount = ", DateCount
for dateCount in range (0,DateCount):
FL = str(Test_Worksheet.cell_value(DateLoc[dateCount],19))# to get selected flight
PL = str(Test_Worksheet.cell_value(DateLoc[dateCount],10)) # to get selected flight's price
DEPL = str(Test_Worksheet.cell_value(DateLoc[dateCount],7)) # to get selected flight's departure time
flightColumn = str(DateLoc[dateCount]) # to get corresponding column of the selected flight
print "enter"
ADDL = flightColumn + " Flight = " + FL + " Price = " + PL + "Rs" + " Dept Time = " + DEPL
FlishtsLists.append(ADDL) # print's when available flight's button is pressed
print "exit"
## FlishtsListsCol.append()
FlishtsLists.append("AnyOne") # adds anyone option too
print "FlishtsLists = ",FlishtsLists
#=============================================================================
"""Available flight Label"""
Label(f4, text="Available Flights", fg = "red",font=('Lucida Sans Typewriter',(15), "bold")).pack(side = LEFT,
padx = 10,
pady = 40)
## f4 = Frame(mf)
## f4.pack(fill=X)
global v5
v5 = StringVar() # will take selected flights value
Values = FlishtsLists
w = Combobox(f4,values = Values ,width = 60, height = 5, textvariable= v5)
w.bind('<<ComboboxSelected>>',PassFlightCol)
w.pack(side = LEFT,padx = 10, pady = 40)
Button(f4, text="SUGGEST",fg ="white" ,bg = "blue" ,font=('Lucida Sans Typewriter',(10), 'bold'),
command=lambda: Suggest1()).pack(side = LEFT, padx=10,pady=40)
return
开发者ID:anusha-vijaykumar,项目名称:Prognosticting_Airfares_using_RandomForests,代码行数:82,代码来源:GenericFlightContinuTreeNext.py
示例10: MainWindow
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class MainWindow(Tk):
def __init__(self):
Tk.__init__(self)
self.title(mainWindowTitle)
self.resizable(width=0, height=0)
self.__setStyles()
self.__initializeComponents()
self.__dataController = DataController();
self.mainloop()
def __initializeComponents(self):
self.imageCanvas = Canvas(master=self, width=imageCanvasWidth,
height=windowElementsHeight, bg="white")
self.imageCanvas.pack(side=LEFT, padx=(windowPadding, 0),
pady=windowPadding, fill=BOTH)
self.buttonsFrame = Frame(master=self, width=buttonsFrameWidth,
height=windowElementsHeight)
self.buttonsFrame.propagate(0)
self.loadFileButton = Button(master=self.buttonsFrame,
text=loadFileButtonText, command=self.loadFileButtonClick)
self.loadFileButton.pack(fill=X, pady=buttonsPadding);
self.colorByLabel = Label(self.buttonsFrame, text=colorByLabelText)
self.colorByLabel.pack(fill=X)
self.colorByCombobox = Combobox(self.buttonsFrame, state=DISABLED,
values=colorByComboboxValues)
self.colorByCombobox.set(colorByComboboxValues[0])
self.colorByCombobox.bind("<<ComboboxSelected>>", self.__colorByComboboxChange)
self.colorByCombobox.pack(fill=X, pady=buttonsPadding)
self.rejectedValuesPercentLabel = Label(self.buttonsFrame, text=rejectedMarginLabelText)
self.rejectedValuesPercentLabel.pack(fill=X)
self.rejectedValuesPercentEntry = Entry(self.buttonsFrame)
self.rejectedValuesPercentEntry.insert(0, defaultRejectedValuesPercent)
self.rejectedValuesPercentEntry.config(state=DISABLED)
self.rejectedValuesPercentEntry.pack(fill=X, pady=buttonsPadding)
self.colorsSettingsPanel = Labelframe(self.buttonsFrame, text=visualisationSettingsPanelText)
self.colorsTableLengthLabel = Label(self.colorsSettingsPanel, text=colorsTableLengthLabelText)
self.colorsTableLengthLabel.pack(fill=X)
self.colorsTableLengthEntry = Entry(self.colorsSettingsPanel)
self.colorsTableLengthEntry.insert(0, defaultColorsTableLength)
self.colorsTableLengthEntry.config(state=DISABLED)
self.colorsTableLengthEntry.pack(fill=X)
self.scaleTypeLabel = Label(self.colorsSettingsPanel, text=scaleTypeLabelText)
self.scaleTypeLabel.pack(fill=X)
self.scaleTypeCombobox = Combobox(self.colorsSettingsPanel, state=DISABLED,
values=scaleTypesComboboxValues)
self.scaleTypeCombobox.set(scaleTypesComboboxValues[0])
self.scaleTypeCombobox.bind("<<ComboboxSelected>>", self.__scaleTypeComboboxChange)
self.scaleTypeCombobox.pack(fill=X)
self.colorsTableMinLabel = Label(self.colorsSettingsPanel, text=colorsTableMinLabelText)
self.colorsTableMinLabel.pack(fill=X)
self.colorsTableMinEntry = Entry(self.colorsSettingsPanel)
self.colorsTableMinEntry.insert(0, defaultColorsTableMin)
self.colorsTableMinEntry.config(state=DISABLED)
self.colorsTableMinEntry.pack(fill=X)
self.colorsTableMaxLabel = Label(self.colorsSettingsPanel, text=colorsTableMaxLabelText)
self.colorsTableMaxLabel.pack(fill=X)
self.colorsTableMaxEntry = Entry(self.colorsSettingsPanel)
self.colorsTableMaxEntry.insert(0, defaultColorsTableMax)
self.colorsTableMaxEntry.config(state=DISABLED)
self.colorsTableMaxEntry.pack(fill=X)
self.colorsSettingsPanel.pack(fill=X, pady=buttonsPadding)
self.redrawButton = Button(master=self.buttonsFrame, text=redrawButtonText,
state=DISABLED, command=self.__redrawButtonClick)
self.redrawButton.pack(fill=X, pady=buttonsPadding)
self.buttonsFrame.pack(side=RIGHT, padx=windowPadding, pady=windowPadding, fill=BOTH)
def __setStyles(self):
Style().configure("TButton", padding=buttonsTextPadding, font=buttonsFont)
def loadFileButtonClick(self):
fileName = tkFileDialog.askopenfilename(filetypes=[('Tablet files', '*.mtb'), ('Tablet files', '*.htd')])
if (fileName):
if (not self.__getInputParams()):
self.__showInvalidInputMessage()
return
self.lastFileName = fileName;
self.title(mainWindowTitle + " " + fileName)
self.__draw(fileName)
tkMessageBox.showinfo(measureDialogTitle,
measureDialogText + str(self.__dataController.getMeasure(fileName)))
self.redrawButton.config(state=NORMAL)
self.colorByCombobox.config(state="readonly")
self.colorsTableLengthEntry.config(state=NORMAL)
self.scaleTypeCombobox.config(state="readonly")
def __redrawButtonClick(self):
if (not self.__getInputParams()):
self.__showInvalidInputMessage()
return
self.__draw(self.lastFileName)
def __scaleTypeComboboxChange(self, event):
if (self.scaleTypeCombobox.get() == relativeScaleType):
#.........这里部分代码省略.........
示例11: GUI_elements
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class GUI_elements(object): # GUI objects, including those accessed
# during session; initialize only once
def __init__(self, master, app):
self.master = master
if app_state['exec_mode'] == 'PVS-client':
emacs_pid = pvs_eval_and_wait('(emacs-pid)')
else:
emacs_pid = app_state['exec_mode']
master.title('Hypatheon Client for PVS (%s)' % emacs_pid)
if on_aqua: pass # no separtor needed on OS X
else:
Frame(master, height=1, bg='black', bd=0
).pack(fill=X, expand=YES)
status_row = Frame(master) # drawing info displays, control buttons
self.status_msg, self.prover_status, self.import_status, \
self.exec_mode_status = \
[ Label(status_row, relief=SUNKEN, bd=1, padx=5,
font=text_font)
for i in range(4) ] # must match number of fields
self.status_msg['text'] = 'Welcome to Hypatheon '
for widget in (self.status_msg, self.prover_status, self.import_status):
widget.pack(padx=2, side=LEFT)
Frame(status_row).pack(side=LEFT, fill=X, expand=YES)
if on_aqua: # avoid resize handle on lower right
Frame(status_row).pack(padx=10, side=RIGHT)
self.exec_mode_status.pack(padx=2, side=RIGHT)
status_row.pack(padx=5, pady=2, fill=X, side=BOTTOM)
self.create_query_control_area(master)
self.query_history = [] # collect previous queries for listbox
if on_osx: main_geometry = '+0+40' # upper left, with Y offset
else: main_geometry = '-0+0' # upper right
master.geometry(newGeometry=main_geometry)
master.deiconify()
# At the top of the main window is where queries are entered and launched.
# This region contains a few Entry widgets for entering search terms
# plus the buttons needed for control.
def create_query_control_area(self, win):
def clear_entries():
for ent in self.q_entries: ent.delete(0, END)
self.q_entries[0].focus_set()
bind_control_key(win, 'u', clear_entries)
def invoke_query(dummy=None, terms=None, explicit_query=1):
if terms == None:
first = self.q_entries[0].get()
if ';' in first:
packed = split_and_pad_terms(first)
terms = [ term.strip() for term in packed ]
else:
terms = [ ent.get().strip() for ent in self.q_entries ]
results = submit_query(terms, explicit_query)
if not explicit_query and not results:
return results
for ent, term in zip(self.q_entries, terms):
ent.delete(0, END)
ent.insert(END, term)
return results
self.invoke_query_handler = \
EventHandler('Invoke query choice', invoke_query)
button_width = 5
def make_bottom_right(parent):
try:
# If the ttk combo-box widget is available, use it for the
# Types field. Otherwise, create one out of other Tk widgets.
from ttk import Combobox
itypes = [ ' ' + t for t in cap_item_types ]
self.type_ent = Combobox(parent, values=itypes,
width=(query_entry_width - 6),
height=len(itypes))
self.ttk_type_entry = 1
return self.type_ent
except:
self.ttk_type_entry = 0 # ttk not present
bottom_right = Frame(parent)
self.type_ent = entry_widget(bottom_right,
width=(query_entry_width - 6))
self.type_ent.pack(side=LEFT, fill=X, expand=YES)
self.types_pulldown_button = \
Button(bottom_right, text=u_triagdn, pady=0, anchor=S,
command=EventHandler('Display file type list',
self.types_pull_down))
self.types_pulldown_button.pack(side=LEFT, padx=2)
return bottom_right
def col_4(parent, row):
if row == 0:
return entry_widget(parent, width=query_entry_width)
else:
return make_bottom_right(parent)
def col_6(parent, row):
if row == 0:
return ThinButton(parent, text='Clear', width=button_width,
command=EventHandler('Clear entries',
clear_entries, 0))
#.........这里部分代码省略.........
示例12: __init__
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
def __init__(self, parent, controller):
Frame.__init__(self, parent)
#VARIABLES GLOBALES
global cedula, titulo, residencia, nombres, apellidos, direccion, telefono, envio, correo, celular, dia, mes, profesion, empresa, oficina, tel, telfax, banco, tcuenta, numcuenta, tipopersona, retefuente, reteiva, gcontribuyente, gfactura, gcheque, notas, co1cc, co1nombres, co1dir, co1tel1, co1cargo, co1empresa, co1oficina, co1tel2, co2cc, co2nombres, co2dir, co2tel1, co2cargo, co2empresa, co2oficina, co2tel2, co3cc, co3nombres, co3dir, co3tel1, co3cargo, co3empresa, co3oficina, co3tel2, lb, note, busqueda, dato, E
#INSTANCIEAS DE LOS WIDGETS
global codeE, refE, cityE, nameE, lastnameE, adressE, phoneE, mailE, emailE, mobileE, birthdayE, birthdayCbx, ocupationE, companyE, ofiE, officetelE, faxE, bankCbx, banktypeCbx, numbankE, personR1, personR2, Ch1, Ch2, Ch3, Ch4, Ch5, note, cc1E, name1E, adress1E, phone1E, job1E, jobphone1E, office1E, officetel1E, cc2E, name2E, adress2E, phone2E, job2E, jobphone2E, office2E, officetel2E, cc3E, name3E, adress3E, phone3E, job3E, jobphone3E, office3E, officetel3E, add, update, delete, clean, cancel
global info, _arrendatarios
_arrendatarios = dict()
#Variables
cedula = StringVar()
titulo = StringVar()
residencia = StringVar()
nombres = StringVar()
apellidos = StringVar()
direccion = StringVar()
telefono = StringVar()
envio = StringVar()
correo = StringVar()
celular = StringVar()
dia = IntVar()
mes = StringVar()
meses = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto","Septiembre", "Octubre", "Noviembre", "Diciembre"]
profesion = StringVar()
empresa = StringVar()
oficina = StringVar()
tel = StringVar()
telfax = StringVar()
banco = StringVar()
bancos = ['Bancolombia', "Banco Bogotá", "Banco Agrario", "Banco Occidente"]
banktype = ['Corriente','Ahorro']
tcuenta = StringVar()
numcuenta = StringVar()
tipopersona = IntVar()
retefuente = IntVar()
reteiva = IntVar()
gcontribuyente = IntVar()
gfactura = IntVar()
gcheque = IntVar()
notas = StringVar()
#----------------------------
co1cc = StringVar()
co1nombres = StringVar()
co1dir = StringVar()
co1tel1 = StringVar()
co1cargo = StringVar()
co1empresa = StringVar()
co1oficina = StringVar()
co1tel2 = StringVar()
co2cc = StringVar()
co2nombres = StringVar()
co2dir = StringVar()
co2tel1 = StringVar()
co2cargo = StringVar()
co2empresa = StringVar()
co2oficina = StringVar()
co2tel2 = StringVar()
co3cc = StringVar()
co3nombres = StringVar()
co3dir = StringVar()
co3tel1 = StringVar()
co3cargo = StringVar()
co3empresa = StringVar()
co3oficina = StringVar()
co3tel2 = StringVar()
#BUSQUEDA = ["Nombre","CC/Nit"]
busqueda = StringVar()
busqueda.trace("w", lambda name, index, mode: buscar())
info = IntVar()
dato = StringVar()
#WIDGETS
#========================= HEADER ===========================
self.header = Label(self, text="GESTIÓN DE ARRENDATARIOS", font="bold")
self.header.pack(pady=20, side=TOP)
#========================= WRAPPER ===========================
self.wrapper = Frame (self)
self.wrapper.pack(side=LEFT, fill=Y)
#Esto centro el wrapper
#self.wrapper.pack(side=LEFT, fill=BOTH, expand=True)
#================ NOTEBOOK =============>
self.nb = Notebook(self.wrapper)
#-----------------------> TAB 1
self.tab1 = Frame (self.nb)
#.........这里部分代码省略.........
示例13: UIBidding
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class UIBidding(Notify):
class CoincheException(Exception):
def __init__(self, pid):
self.pid = pid
def __init__(self, root, x, y, size_x, size_y):
Notify.__init__(self)
# Memorise the frame
self._root = root
self._frame = Frame(width = size_x, height = size_y)
# No resize
self._frame.pack_propagate(0)
# Style
self._frame.config(borderwidth = 5)
self._x = x
self._y = y
# Init the buttons
self._init_buttons()
# Will be used to notify the main thread when waiting for a call
self.need_bid_event = Event()
# Will be used to notify the main thread when waiting for a coinche
self.coinche_event = Event()
self.pid = 0
self._last_bid = None
self.enable()
def display(self):
"""
Display the widget on the table
"""
self._frame.place(in_ = self._root, x = self._x, y = self._y)
def hide(self):
"""
Hide the pannel when the biddings are closed for example
"""
self._frame.place_forget()
def _init_color_buttons(self):
"""
Init the buttons to select the color
"""
# Dedicated frame for buttons
self._buttons_frame = Frame()
# This dictionnary will contains all the color buttons
self._buttons = dict()
# Several colors are available
colors = list(Bidding.colors)
colors.pop()
# The buttons need to have a fixed size
h = 2
w = 2
for c in colors:
self._buttons[c] = Button(self._buttons_frame, text=c, \
height=h, width=w, \
command=lambda c=c: self._click_color(c))
self._buttons[c].pack(side = LEFT)
# Pack the dedicated frame into the main frame
self._buttons_frame.pack(in_ = self._frame)
self._selected_color = None
def _init_value_box(self):
"""
Init the list box which select the value of the bid
"""
availableValue = Bidding.values
# TODO: display "pass" instead of "0"
#availableValue[0] = "pass"
self._value_box = Combobox(self._frame, \
values = availableValue, \
# TODO
# Only justify the selected value
#justify = RIGHT, \
state = 'readonly')
self._value_box.bind("<<ComboboxSelected>>", lambda x: self._update_bid_button())
self._value_box.set(availableValue[0])
self._value_box.pack(fill = X)
@staticmethod
#.........这里部分代码省略.........
示例14: __init__
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [as 别名]
class App:
"""Main class for the gui layer."""
def __init__(self, master):
self.master = master
self.master.title("Gaussian Elimination / Jacobi Method")
self.create_widgets(master)
# options for opening or saving a file
self.file_opt = options = {}
options['filetypes'] = [('all files', '*'), ('text files', '.txt'),
('csv files', '.csv')]
def create_widgets(self, master):
"""Populate the main window with gui components."""
# buttons, slider, combobox etc.
frame0 = Frame(master)
frame0.grid(row=1, column=0, sticky=N)
self.scale = Scale(frame0, from_=2, to=2000, orient=HORIZONTAL,
label='Matrix / vector size (n):')
self.scale.pack(fill="x")
btn_gen_mtx = Button(frame0, text="Generate matrix A (n x n)",
command=self.gen_mtx)
btn_gen_mtx.pack(fill="x")
btn_gen_vec = Button(frame0, text="Generate vector B (n)",
command=self.gen_vec)
btn_gen_vec.pack(fill="x")
btn_load_mtx = Button(frame0, text="Load matrix A",
command=self.load_mtx)
btn_load_mtx.pack(fill="x")
btn_load_vec = Button(frame0, text="Load vector B",
command=self.load_vec)
btn_load_vec.pack(fill="x")
btn_solve = Button(frame0, text="SOLVE",
command=self.solve)
btn_solve.pack(fill="x")
self.combobox = Combobox(frame0, state="readonly",
values=("Gauss Method", "Jacobi Method",
"numpy.linalg.solve()"))
self.combobox.pack(fill="x")
self.combobox.set("Gauss Method") # default choice
btn_quit = Button(frame0, text="Quit", command=self.quit)
btn_quit.pack(fill='x', pady=28)
# scrollbar text widget (matrix a)
self.frame1 = Frame(master)
xscrollbar1 = Scrollbar(self.frame1, orient=HORIZONTAL)
xscrollbar1.grid(row=1, column=0, sticky=E+W)
yscrollbar1 = Scrollbar(self.frame1)
yscrollbar1.grid(row=0, column=1, sticky=N+S)
self.text1 = Text(self.frame1, wrap=NONE, bd=0, state=DISABLED,
xscrollcommand=xscrollbar1.set,
yscrollcommand=yscrollbar1.set)
self.text1.grid(row=0, column=0, sticky=N+S+W+E)
xscrollbar1.config(command=self.text1.xview)
yscrollbar1.config(command=self.text1.yview)
self.frame1.grid_rowconfigure(0, weight=1)
self.frame1.grid_columnconfigure(0, weight=1)
self.frame1.grid(row=1, column=1, sticky=N+S+W+E)
# scrollbar text widget (vector b)
self.frame2 = Frame(master)
xscrollbar2 = Scrollbar(self.frame2, orient=HORIZONTAL)
xscrollbar2.grid(row=1, column=0, sticky=E+W)
yscrollbar2 = Scrollbar(self.frame2)
yscrollbar2.grid(row=0, column=1, sticky=N+S)
self.text2 = Text(self.frame2, width=30, wrap=NONE, bd=0,
state=DISABLED, xscrollcommand=xscrollbar2.set,
yscrollcommand=yscrollbar2.set)
self.text2.grid(row=0, column=0, sticky=N+S+E+W)
xscrollbar2.config(command=self.text2.xview)
yscrollbar2.config(command=self.text2.yview)
self.frame2.grid_rowconfigure(0, weight=1)
self.frame2.grid_columnconfigure(0, weight=1)
self.frame2.grid(row=1, column=2, sticky=N+S)
# scrollbar text widget (vector x)
self.frame3 = Frame(master)
xscrollbar3 = Scrollbar(self.frame3, orient=HORIZONTAL)
xscrollbar3.grid(row=1, column=0, sticky=E+W)
yscrollbar3 = Scrollbar(self.frame3)
yscrollbar3.grid(row=0, column=1, sticky=N+S)
self.text3 = Text(self.frame3, width=30, wrap=NONE, bd=0,
state=DISABLED, xscrollcommand=xscrollbar3.set,
yscrollcommand=yscrollbar3.set)
self.text3.grid(row=0, column=0, sticky=N+S+E+W)
xscrollbar3.config(command=self.text3.xview)
yscrollbar3.config(command=self.text3.yview)
self.frame3.grid_rowconfigure(0, weight=1)
self.frame3.grid_columnconfigure(0, weight=1)
self.frame3.grid(row=1, column=3, sticky=N+S)
# labels
label1 = Label(master, text="Matrix A")
label1.grid(row=0, column=1)
label2 = Label(master, text="Vector B")
label2.grid(row=0, column=2)
label3 = Label(master, text="Vector X")
label3.grid(row=0, column=3)
self.bottom_label = Label(master)
self.bottom_label.grid(row=2, column=0, columnspan=4, sticky=W+E)
#.........这里部分代码省略.........
示例15: MainFrame
# 需要导入模块: from ttk import Combobox [as 别名]
# 或者: from ttk.Combobox import pack [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)
#.........这里部分代码省略.........