本文整理汇总了Python中ttk.Combobox类的典型用法代码示例。如果您正苦于以下问题:Python Combobox类的具体用法?Python Combobox怎么用?Python Combobox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Combobox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, master):
#-----------------------Interface gráfica----------------------------------------------------
self.frame1 = Frame(master, bg = COR_FUNDO)
self.frame1.place(relheight = 1.0, relwidth = 1.0)
self.botao_refresh = Button(self.frame1, text = 'Atualizar dispositivos', font = ('Courier','10'),
fg = 'black', bg = COR_BOTAO_2, borderwidth = 3,
command = self.devices)
self.botao_refresh.place(relx = 0.202, rely = 0.02, relwidth = 0.54)
Label(self.frame1, text = 'Escolha o dispositivo(CUIDADO)',
font=('Courier','14'), fg = 'red', bg = COR_FUNDO).place(relx = 0.02, rely = 0.12)
self.device = Combobox(self.frame1, font = ('Ariel','15'))
self.device.place(relx = 0.04, rely = 0.20, relwidth = 0.90)
Label(self.frame1, text='Escolha o Sistema de arquivos',
font=('Courier','14'), fg = 'white', bg = COR_FUNDO).place(relx = 0.02, rely = 0.32)
self.sis = Combobox(self.frame1, font = ('Ariel','15'))
self.sis.place(relx = 0.04, rely = 0.40, relwidth = 0.90)
self.botao_formatar = Button(self.frame1, text = 'Formatar', font = ('Courier','25'),
fg = 'black', bg = COR_BOTAO_1, borderwidth = 3,
command = self.formatar)
self.botao_formatar.bind("<Button-1>", self.mudabotao)
self.botao_formatar.place(relx = 0.21, rely = 0.82, relwidth = 0.54)
self.devices()
self.sis_file()
开发者ID:volneyrock,项目名称:SlkFormat,代码行数:29,代码来源:slkformat.py
示例2: SnapFrame
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)
开发者ID:Jovito,项目名称:tk-piano-roll,代码行数:26,代码来源:snap_frame.py
示例3: __init__
def __init__(self, master, customers, payments, refresh):
Toplevel.__init__(self,master)
self.root = master
self.refresh = refresh
self.title("Check In")
self.iconname = "Check In"
self.name = StringVar() # variable for customer
self.customers = customers # customers object
self.payments = payments
self.names = []
self.workout = StringVar()
self.workouts = []
self.workouts_form = []
self.date = StringVar()
self.date.set(strftime("%m/%d/%Y"))
self.refresh_time = 15 # in minutes
self.output = '' # for the output label at the bottom
self.schedule = Schedule()
self.logger = Logger() #throws IOError if file is open
inf = Frame(self)
inf.pack(padx=10,pady=10,side='top')
Label(inf, text="Name:").grid(row=0,column=0,sticky=E,ipady=2,pady=2,padx=10)
Label(inf, text='Date:').grid(row=1,column=0,sticky=E,ipady=2,pady=2,padx=10)
Label(inf, text="Workout:").grid(row=2,column=0,sticky=E,ipady=2,pady=2,padx=10)
self.name_cb = Combobox(inf, textvariable=self.name, width=30,
values=self.names)
self.name_cb.grid(row=0,column=1,sticky=W,columnspan=2)
self.date_ent = Entry(inf, textvariable=self.date)
self.date_ent.grid(row=1,column=1,sticky=W)
self.date_ent.bind('<FocusOut>', self.update_workouts)
Button(inf,text='Edit', command=self.enable_date_ent).grid(row=1,column=2,sticky=E)
self.workout_cb = Combobox(inf, textvariable=self.workout, width=30,
values=self.workouts_form,state='readonly')
self.workout_cb.grid(row=2,column=1,sticky=W,columnspan=2)
self.log_btn=Button(inf,text="Log Workout",command=self.log,width=12)
self.log_btn.grid(row=3,column=1,columnspan=2,pady=4,sticky='ew')
stf = Frame(self)
stf.pack(padx=10,pady=10,fill='x',side='top')
self.scrolled_text = ScrolledText(stf,height=15,width=50,wrap='word',state='disabled')
self.scrolled_text.pack(expand=True,fill='both')
self.update_workouts()
self.update_names()
self.bind('<Return>',self.log)
self.name_cb.focus_set() # set the focus here when created
#disable the date field
self.disable_date_ent()
#start time caller
self.time_caller()
开发者ID:tylerjw,项目名称:jim_tracker,代码行数:60,代码来源:log_data.py
示例4: __initializeComponents
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)
开发者ID:jsikorski,项目名称:HCC-tablet-data-presenter,代码行数:59,代码来源:interface.py
示例5: __init__
def __init__(self, parent, **kwargs):
"""!
A constructor for the class
@param self The pointer for the object
@param parent The parent object for the frame
@param **kwargs Other arguments as accepted by ttk.Combobox
"""
#Initialise the inherited class
Combobox.__init__(self, parent, **kwargs)
开发者ID:benjohnston24,项目名称:stdtoolbox,代码行数:9,代码来源:stdGUI.py
示例6: SendGCode
class SendGCode(LabelFrame):
def __init__(self, root, prtr, settings, log, *arg):
LabelFrame.__init__(self, root, *arg, text="Send gcode")
self.app = root
self.printer = prtr
self.settings = settings
self.log = log
self.entry = Entry(self, width=50)
self.entry.grid(row=1, column=1, columnspan=3, sticky=N+E+W)
self.bSend = Button(self, text="Send", width=4, command=self.doSend, state=DISABLED)
self.bSend.grid(row=1, column=4, padx=2)
self.entry.delete(0, END)
self.entry.bind('<Return>', self.hitEnter)
self.gcv = StringVar(self)
gclist = gcoderef.gcKeys()
self.gcv.set(gclist[0])
l = Label(self, text="G Code Reference:", justify=LEFT)
l.grid(row=2, column=1, columnspan=2, sticky=W)
self.gcm = Combobox(self, textvariable=self.gcv)
self.gcm['values'] = gclist
self.gcm.grid(row=2, column=3, padx=2)
self.gcm.bind('<<ComboboxSelected>>', self.gcodeSel)
#self.bInfo = Button(self, text="Info", width=9, command=self.doInfo)
#self.bInfo.grid(row=2, column=4, padx=2)
#def doInfo(self):
def gcodeSel(self, *arg):
verb = self.gcv.get()
self.log.logMsg("%s: %s" % (verb, gcoderef.gcText(verb)))
def activate(self, flag):
if flag:
self.bSend.config(state=NORMAL)
else:
self.bSend.config(state=DISABLED)
def hitEnter(self, e):
self.doSend()
def doSend(self):
cmd = self.entry.get()
verb = cmd.split()[0]
if self.app.printerAvailable(cmd=verb):
self.log.logMsg("Sending: %s" % cmd)
self.printer.send_now(cmd)
开发者ID:jbernardis,项目名称:repraphost,代码行数:55,代码来源:sendgcode.py
示例7: __init__
def __init__(self, master, customers, payments, output_text, refresh):
Frame.__init__(self, master)
self.refresh = refresh
self.master = master
self.output_text = output_text
self.customers = customers
self.payments = payments
self.pname = StringVar()
self.pnames = []
self.mname = StringVar()
self.mnames = []
self.date = StringVar()
self.nmonths = StringVar()
self.punches = StringVar()
self.nmonths.set('1')
self.punches.set(str(10))
self.date.set(strftime("%m/%d/%Y"))
self.columnconfigure(0,weight=1)
# Monthly Customers
monthly_lf = LabelFrame(self, text="Monthly Customers Payment")
monthly_lf.grid(padx=5,pady=5,row=0,column=0,sticky='ew')
Label(monthly_lf,text="Name:").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
Label(monthly_lf,text="Date:").grid(row=0,column=3,sticky='e',padx=(10,0),pady=(10,2))
Label(monthly_lf,text="# Months:").grid(row=1,column=0,columnspan=2,sticky='e',padx=(10,0),pady=(2,10))
self.mname_cb = Combobox(monthly_lf,textvariable=self.mname,width=20,values=self.mnames,
state='readonly')
self.mname_cb.grid(row=0,column=1,columnspan=2,sticky='ew',pady=(10,2))
Entry(monthly_lf,textvariable=self.date,width=15).grid(row=0,column=4,sticky='ew',padx=(0,10),pady=(10,2))
Entry(monthly_lf,textvariable=self.nmonths).grid(row=1,column=2,sticky='ew',pady=(2,10))
Button(monthly_lf,text='Submit',command=self.monthly_payment).grid(row=1,column=4,sticky='ew',padx=(0,10),pady=(2,10))
for i in range(5):
monthly_lf.columnconfigure(i,weight=1)
# Punch Card Customers
puch_lf = LabelFrame(self, text="Punch Card Customers (Purchace Card)")
puch_lf.grid(padx=5,pady=5,row=1,column=0,sticky='ew')
Label(puch_lf,text="Name:").grid(row=0,column=0,sticky='e',padx=(10,0),pady=(10,2))
Label(puch_lf,text="Punches:").grid(row=0,column=2,sticky='e',pady=(10,2))
self.pname_cb = Combobox(puch_lf,textvariable=self.pname,width=20,values=self.pnames,state='readonly')
self.pname_cb.grid(row=0,column=1,sticky='ew',pady=(10,2))
Entry(puch_lf,textvariable=self.punches,width=15).grid(row=0,column=3,sticky='ew',padx=(0,10),pady=(10,2))
Button(puch_lf,text='Submit',command=self.new_punchcard).grid(row=3,column=3,sticky='ew',padx=(0,10),pady=(2,10))
for i in range(4):
puch_lf.columnconfigure(i,weight=1)
self.update_names()
开发者ID:tylerjw,项目名称:jim_tracker,代码行数:55,代码来源:payment.py
示例8: add_param_fields
def add_param_fields(self, frame, rownum, object_map):
#create the fields
key_option_val = StringVar(frame)
key_option_val.set(self.keywords[0])
key_option_menu = Combobox(frame, textvariable=key_option_val, state='readonly')
key_option_menu['values'] = self.keywords
key_option_menu.grid(row=0, column=0, sticky=W, pady=10, padx=10)
val_text = StringVar(frame)
val_entry = Entry(frame, textvariable=val_text)
val_entry.grid(row=0, column=1, pady=10, padx=10, sticky=W)
object_map.append((key_option_val, val_text))
开发者ID:ZhewenSong,项目名称:USIT,代码行数:13,代码来源:ingredients.py
示例9: initUI
def initUI(self):
self.parent.title("TRAM")
self.style = Style()
self.style.theme_use("default")
self.pack(fill=BOTH, expand=1)
#Model Text
self.t = Text(self, borderwidth=3, relief="sunken")
self.t.config(font=("consolas", 12), undo=True, wrap='word')
self.t.grid(row=0, column=0, padx=2, pady=2, sticky=(N, W, E, S))
#Search Panel
searchPanel = LabelFrame(self, text="Find your model")
searchPanel.grid(row=0, column=1, padx=2, pady=2, sticky=N)
Label(searchPanel, text="Model name").grid(row=0, column=0, padx=2, pady=2, sticky=W)
searchQueryEntry = Entry(searchPanel, textvariable=self.searchQuery)
searchQueryEntry.grid(row=0, column=1, padx=2, pady=2, sticky=W)
Label(searchPanel, text="Transformation").grid(row=1, column=0, padx=2, pady=2, sticky=W)
preferredTransformation = StringVar()
box = Combobox(searchPanel, textvariable=preferredTransformation, state='readonly')
box['values'] = ('Any...', 'Object Change', 'Object Extension', 'Specialization', 'Functionality Extension', 'System Extension', 'Soft Simplification', 'Hard Simplification')
box.current(0)
box.grid(row=1, column=1, padx=2, pady=2, sticky=W)
findButton = Button(searchPanel, text="Find", command = self.__findModels)
findButton.grid(row=2, column=1, padx=2, pady=2, sticky=E)
#Listbox with recommendations
recommendationPanel = LabelFrame(self, text="Recommended models (transformations)")
recommendationPanel.grid(row=0, column=1, padx=2, pady=2, sticky=(W,E,S))
self.l = Listbox(recommendationPanel)
self.l.pack(fill=BOTH, expand=1)
#Button frame
transformButtonPanel = Frame(recommendationPanel)
transformButtonPanel.pack(fill=BOTH, expand=1)
viewButton = Button(transformButtonPanel, text="View", command = self.__loadSelectedModel)
viewButton.grid(row=1, column=0, padx=2, pady=2)
transformButton = Button(transformButtonPanel, text="Transform", command = self.__transformModel)
transformButton.grid(row=1, column=2, padx=2, pady=2)
开发者ID:alessioferrari,项目名称:tram,代码行数:49,代码来源:TRAMapp.py
示例10: editor
def editor():
"""Run editor"""
global zone_dessin
global grid
global entry_retour
global combobox_difficulty
global lvlList
grid = Grid()
# Windows
fenetre = Tk()
fenetre.geometry("500x525")
fenetre.title("Editeur Hanjie")
fenetre.resizable(width=False, height=False)
# Canvas
zone_dessin = Canvas(fenetre,width=500,height=500, bg="white")
zone_dessin.place(x=0,y=0)
Initialisation()
zone_dessin.bind("<Button-1>", Swap)
# Entry
default_text = StringVar()
entry_retour = Entry(fenetre,width=20,textvariable=default_text)
default_text.set("Level name...")
entry_retour.place(x=2,y=503)
# Save Button
button_save = Button(fenetre,text="Save", width=8,height=1, command = But_Save)
button_save.place(x=130,y=500)
# Load Button
button_load = Button(fenetre,text="Load", width=8,height=1, command = But_Load)
button_load.place(x=200,y=500)
# Reset Button
button_load = Button(fenetre,text="Reset", width=8,height=1, command = But_Reset)
button_load.place(x=270,y=500)
# Difficulty Combobox
lvlSelect = StringVar()
lvlList = ('LVL 1', 'LVL 2', 'LVL 3', 'LVL 4', 'LVL 5')
combobox_difficulty = Combobox(fenetre, values = lvlList, state = 'readonly')
combobox_difficulty.set(lvlList[0])
combobox_difficulty.place(x=340,y=502)
fenetre.mainloop()
开发者ID:flomonster,项目名称:Hanjie,代码行数:49,代码来源:Editor.py
示例11: JournalEntry
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)
开发者ID:thegricean,项目名称:lazyjournal,代码行数:15,代码来源:lazyjournal.py
示例12: __init__
def __init__(self, root, prtr, settings, log, *arg):
LabelFrame.__init__(self, root, *arg, text="Send gcode")
self.app = root
self.printer = prtr
self.settings = settings
self.log = log
self.entry = Entry(self, width=50)
self.entry.grid(row=1, column=1, columnspan=3, sticky=N+E+W)
self.bSend = Button(self, text="Send", width=4, command=self.doSend, state=DISABLED)
self.bSend.grid(row=1, column=4, padx=2)
self.entry.delete(0, END)
self.entry.bind('<Return>', self.hitEnter)
self.gcv = StringVar(self)
gclist = gcoderef.gcKeys()
self.gcv.set(gclist[0])
l = Label(self, text="G Code Reference:", justify=LEFT)
l.grid(row=2, column=1, columnspan=2, sticky=W)
self.gcm = Combobox(self, textvariable=self.gcv)
self.gcm['values'] = gclist
self.gcm.grid(row=2, column=3, padx=2)
self.gcm.bind('<<ComboboxSelected>>', self.gcodeSel)
开发者ID:jbernardis,项目名称:repraphost,代码行数:29,代码来源:sendgcode.py
示例13: __init__
def __init__(self, menu):
Tk.__init__(self)
self.title("Pick a level")
icon = PhotoImage(file=os.getcwd() + '/res/logo/logo.gif')
self.tk.call("wm", "iconphoto", self._w, icon)
self.eval('tk::PlaceWindow %s center' % self.winfo_pathname(self.winfo_id()))
self.levels = [file[:-4] for file in listdir("res/levels")]
self.protocol("WM_DELETE_WINDOW", self.shutdownTTK)
if not self.levels: # No levels
self.withdraw()
tkMessageBox.showwarning("Error", 'There doesn\'t seem to be any levels saved. Create one pressing the "Design Level" button!')
self.shutdownTTK()
else:
self.menu = menu
self.value = StringVar()
self.levels_list = Combobox(self, textvariable=self.value, state='readonly')
self.levels_list['values'] = self.levels
self.levels_list.current(0)
self.levels_list.grid(column=0, row=0)
self.button = Button(self, text="Begin Level", command=self.begin_level)
self.button.grid(column=0, row=1)
self.mainloop()
开发者ID:Vicyorus,项目名称:BattleTank,代码行数:31,代码来源:Menu.py
示例14: init_ui
def init_ui(self):
self.parent.title("Activity Logger")
self.parent.focusmodel("active")
self.style = Style()
self.style.theme_use("aqua")
self.combo_text = StringVar()
cb = self.register(self.combo_complete)
self.combo = Combobox(self,
textvariable=self.combo_text,
validate="all",
validatecommand=(cb, '%P'))
self.combo['values'] = ["Food", "Email", "Web"]
self.combo.pack(side=TOP, padx=5, pady=5, fill=X, expand=0)
#self.entry = Text(self, bg="white", height="5")
#self.entry.pack(side=TOP, padx=5, pady=5, fill=BOTH, expand=1)
self.pack(fill=BOTH, expand=1)
self.centre()
self.ok = Button(self, text="Ok", command=self.do_ok)
self.ok.pack(side=RIGHT, padx=5, pady=5)
self.journal = Button(self, text="Journal", command=self.do_journal)
self.journal.pack(side=RIGHT, padx=5, pady=5)
self.exit = Button(self, text="Exit", command=self.do_exit)
self.exit.pack(side=RIGHT, padx=5, pady=5)
开发者ID:da4089,项目名称:alog,代码行数:31,代码来源:alog.py
示例15: initializeComponents
def initializeComponents(self):
self.boxValue = StringVar()
self.boxValue.trace('w', \
lambda name, index, mode, \
boxValue = self.boxValue : \
self.box_valueEditted(boxValue))
self.box = Combobox(self,\
justify = 'left',\
width = 50, \
textvariable = self.boxValue,\
)
self.box.pack(side = 'left',expand = 1, padx = 5, pady = 5)
self.box.bind('<<ComboboxSelected>>',self.box_selected)
self.box.bind('<Return>',self.box_returned)
self.importButton = Button(self, \
text = "Import", \
command = self.importButton_clicked,\
)
self.importButton.pack(side = 'left',expand = 1)
self.cmd_str = StringVar(None,"Prefix Only")
self.switchButton = Button(self, \
textvariable = self.cmd_str, \
command = self.switchButton_clicked, \
)
self.switchButton.pack(side = 'right', padx = 5, pady = 5)
开发者ID:jz33,项目名称:Autocomplete-Trie-Python,代码行数:28,代码来源:View.py
示例16: __init__
def __init__(self, parent, projects, onCreation=None):
Frame.__init__(self, parent)
self.onCreation = onCreation
self.time = StringVar()
self.time.set("00:00:00")
self.timeEntry = None
self.projects = projects.values()
self.projects.sort(key=lambda x: x.name)
l = Label(self, text="Description")
l.grid(row=0, column=0)
self.description = StringVar()
e = Entry(self, textvariable=self.description, font=("Helvetica", 16))
e.grid(row=1, column=0)
l = Label(self, text="Project")
l.grid(row=0, column=1)
values = map(lambda x: x.name, self.projects)
self.projectChooser = Combobox(self, values=values, font=("Helvetica", 16))
self.projectChooser.grid(row=1, column=1)
self.timeEntryClock = Label(self, textvariable=self.time, font=("Helvetica", 16))
self.timeEntryClock.grid(row=1, column=2)
self.submitText = StringVar()
self.submitText.set("Start")
self.submit = Button(self, textvariable=self.submitText, command=self.start, font=("Helvetica", 16))
self.submit.grid(row=1, column=3, padx=10)
开发者ID:ramblex,项目名称:lite-toggl,代码行数:33,代码来源:time_entry_widget.py
示例17: createBitFrame
def createBitFrame(self, bit):
solCardBitFrm = Frame(self.solCardFrm, borderwidth = 5, relief=RAISED)
self.bitFrms.append(solCardBitFrm)
solCardBitFrm.grid(column = rs232Intf.NUM_SOL_PER_BRD - bit - 1, row = 0)
tmpLbl = Label(solCardBitFrm, text="%s" % GameData.SolBitNames.SOL_BRD_BIT_NAMES[self.brdNum][bit])
tmpLbl.grid(column = 0, row = 0, columnspan = 2)
#Read config and set btnCfg
cmdOffset = rs232Intf.CFG_BYTES_PER_SOL * bit
holdOffset = cmdOffset + rs232Intf.DUTY_CYCLE_OFFSET
if (GameData.SolBitNames.SOL_BRD_CFG[self.brdNum][cmdOffset] == rs232Intf.CFG_SOL_AUTO_CLR) or \
(ord(GameData.SolBitNames.SOL_BRD_CFG[self.brdNum][holdOffset]) != 0):
self.btnCfgBitfield |= (1 << bit)
#Combobox menu for button presses
self.indBitOptMenu.append(StringVar())
if (self.btnCfgBitfield & (1 << bit)):
self.indBitOptMenu[bit].set("Toggle")
else:
self.indBitOptMenu[bit].set("Pulse")
tmpCB = Combobox(solCardBitFrm, textvariable=self.indBitOptMenu[bit], width=6, state="readonly")
tmpCB["values"] = ("Pulse", "Toggle")
tmpCB.grid(column = 0, row = 1, columnspan = 2)
self.indBitOptMenu[bit].trace("w", lambda name, index, op, tmp=bit: self.comboboxcallback(tmp))
#Button code
if (self.btnCfgBitfield & (1 << bit)):
#Toggle button so use the old style so button can stay pressed
tmpBtn = Btn(solCardBitFrm, text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp))
tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=8, pady=8)
else:
#Pulse button so use the new style
tmpBtn = Button(solCardBitFrm, text="SimSwitch", command=lambda tmp=bit: self.toggle(tmp))
tmpBtn.grid(column = 0, row = 2, columnspan = 2, padx=4, pady=12)
self.toggleBtn.append(tmpBtn)
self.toggleState.append(False)
tmpLbl = Label(solCardBitFrm, text="Value")
tmpLbl.grid(column = 0, row = 3)
self.indBitStatLbl.append(StringVar())
self.indBitStatLbl[bit].set("0")
tmpLbl = Label(solCardBitFrm, textvariable=self.indBitStatLbl[bit], relief=SUNKEN)
tmpLbl.grid(column = 1, row = 3)
#Button for pulsing solenoid
tmpBtn = Button(solCardBitFrm, text="PulseSol", command=lambda tmp=bit: self.pulsesol(tmp))
tmpBtn.grid(column = 0, row = 4, columnspan = 2, padx=4, pady=12)
开发者ID:Shifter1,项目名称:open-pinball-project,代码行数:47,代码来源:tkSolBrd.py
示例18: LevelsWindow
class LevelsWindow(Tk):
def __init__(self, menu):
Tk.__init__(self)
self.title("Pick a level")
icon = PhotoImage(file=os.getcwd() + '/res/logo/logo.gif')
self.tk.call("wm", "iconphoto", self._w, icon)
self.eval('tk::PlaceWindow %s center' % self.winfo_pathname(self.winfo_id()))
self.levels = [file[:-4] for file in listdir("res/levels")]
self.protocol("WM_DELETE_WINDOW", self.shutdownTTK)
if not self.levels: # No levels
self.withdraw()
tkMessageBox.showwarning("Error", 'There doesn\'t seem to be any levels saved. Create one pressing the "Design Level" button!')
self.shutdownTTK()
else:
self.menu = menu
self.value = StringVar()
self.levels_list = Combobox(self, textvariable=self.value, state='readonly')
self.levels_list['values'] = self.levels
self.levels_list.current(0)
self.levels_list.grid(column=0, row=0)
self.button = Button(self, text="Begin Level", command=self.begin_level)
self.button.grid(column=0, row=1)
self.mainloop()
def begin_level(self):
level = self.levels_list.get()
self.shutdownTTK()
self.menu.call_to("GameWindow", level)
def shutdownTTK(self):
# For some unholy reason, TTK won't shut down when we destroy the window
# so we have to explicitly kill it.
self.eval('::ttk::CancelRepeat')
self.destroy()
开发者ID:Vicyorus,项目名称:BattleTank,代码行数:46,代码来源:Menu.py
示例19: ComboBox
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])
开发者ID:hjuinj,项目名称:Typer,代码行数:26,代码来源:ComboBox.py
示例20: FrOptions
class FrOptions(LabelFrame):
def __init__(self, title, txt, dicoprofils):
LabelFrame.__init__(self, text=title)
self.listing_profils(dicoprofils)
# Dropdowm list of available profiles
self.ddprofils = Combobox(self,
values = dicoprofils.keys(),
width = 35,
height = len(dicoprofils.keys())*20)
self.ddprofils.current(1) # set the dropdown list to first element
# export options
caz_doc = Checkbutton(self, text = u'HTML / Word (.doc/.docx)',
variable = self.master.opt_doc)
caz_xls = Checkbutton(self, text = u'Excel 2003 (.xls)',
variable = self.master.opt_xls)
caz_xml = Checkbutton(self, text = u'XML (ISO 19139)',
variable = self.master.opt_xml)
# Basic buttons
self.action = StringVar()
self.action.set(txt.get('gui_choprofil'))
self.val = Button(self, textvariable = self.action,
relief= 'raised',
command = self.bell)
can = Button(self, text = 'Cancel (quit)',
relief= 'groove',
command = self.master.destroy)
# Widgets placement
self.ddprofils.bind('<<ComboboxSelected>>', self.alter_val)
self.ddprofils.grid(row = 1, column = 0, columnspan = 3, sticky = N+S+W+E, padx = 2, pady = 5)
caz_doc.grid(row = 2, column = 0, sticky = N+S+W, padx = 2, pady = 1)
caz_xls.grid(row = 3, column = 0, sticky = N+S+W, padx = 2, pady = 1)
caz_xml.grid(row = 4, column = 0, sticky = N+S+W, padx = 2, pady = 1)
self.val.grid(row = 5, column = 0, columnspan = 2,
sticky = N+S+W+E, padx = 2, pady = 5)
can.grid(row = 5, column = 2, sticky = N+S+W+E, padx = 2, pady = 5)
def listing_profils(self, dictprofils):
u""" List existing profilesin folder \data\profils """
for i in glob(r'../data/profils/*.xml'):
dictprofils[path.splitext(path.basename(i))[0]] = i
## if new > 0:
## listing_lang()
## load_textes(deroul_lang.get())
## deroul_profils.setlist(sorted(dico_profils.keys()))
## fen_choix.update()
# End of function
return dictprofils
def alter_val(self, inutile):
u""" Switch the label of the validation button contained in basics class
in the case that a new profile is going to be created"""
if self.ddprofils.get() == self.master.blabla.get('gui_nouvprofil'):
self.action.set(self.master.blabla.get('gui_crprofil'))
else:
self.action.set(self.master.blabla.get('gui_choprofil'))
# End of functionFin de fonction
return self.action
开发者ID:Guts,项目名称:Metadator,代码行数:60,代码来源:test_ClassGUI_MultiFrames.py
注:本文中的ttk.Combobox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论