本文整理汇总了Python中tkinter.ttk.Combobox.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.delete方法的具体用法?Python Combobox.delete怎么用?Python Combobox.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk.Combobox
的用法示例。
在下文中一共展示了Combobox.delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EntryVidget
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import delete [as 别名]
#.........这里部分代码省略.........
if self._is_changing:
# Raise error
raise ValueError('Text is changing')
# If the text is not changing.
# Set text changing flag on
self._is_changing = True
# If notify event
if notify:
# Notify pre-change event
self.handler_notify(
self.TEXT_CHANGE_SOON,
arg=notify_arg,
need_info=True,
)
# Cache the text
self._text = text
# If caller is not validator,
# need change text widget's value.
if not is_validator:
# Unmount the validator wrapper before changing text widget's value
self._validator_wrapper_unmount()
# Set text widget to NORMAL state
self.state_set(NORMAL)
# Delete the old text from text widget.
# This will not trigger validation because the validator wrapper
# has been unmounted.
self._text_widget.delete(0, END)
# Insert the new text into text widget.
self._text_widget.insert(0, text)
# Set text widget to previous state
self.state_set_back()
# Mount the validator wrapper after changing text widget's value
self._validator_wrapper_mount()
# If caller is validator
# no need change text widget's value.
# If the cached text is not EQ text widget's value
if self._text != self._text_widget.get():
# If caller is not validator
if not is_validator:
# Set changing flag off
self._is_changing = False
# Raise error
raise ValueError(
'Inconsistent state. `{}` != `{}`'.format(
repr(self._text),
repr(self._text_widget.get()),
)
)
# If caller is validator,
# this is normal because text widget's value will be updated after
# the validator returns.
示例2: reactToClick
# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import delete [as 别名]
#.........这里部分代码省略.........
self.buttonRestricionAdd.bind("<ButtonRelease>", self.reactToClick)
self.buttonRestricionDel.bind("<ButtonRelease>", self.actionRestrictionEnzymeDelete)
self.buttonSpeciesList.bind("<ButtonRelease>", self.actionEditSpeciesButton)
self.buttonSourceLoad.bind("<ButtonRelease>", self.actionLoadSequence)
self.buttonSaveResult.bind("<ButtonRelease>", self.actionSaveSequence)
# TEST
# self.listRestriction.insert("end", "EcoRI")
# self.listRestriction.insert("end", "BamHI")
#
# dummy event to manually trigger update
self.guiRoot.bind("<<Update>>", self.actionUpdate)
self.actionUpdate(None)
self.guiRoot.mainloop()
def actionRestrictionEnzymeDelete(self, event):
try:
selectedEnzyme = self.listRestriction.selection_get()
self.optimizer.restrictionEnzymeList.remove(selectedEnzyme)
self.guiRoot.event_generate("<<Update>>")
except tkinter.TclError:
# no selection
pass
def actionUpdate(self, event):
# print("update called")
# clear list of restriction enzymes
self.listRestriction.delete(0, "end")
for r in self.optimizer.restrictionEnzymeList:
self.listRestriction.insert("end", r)
self.comboSourceSpecies.delete(0, "end")
self.comboTargetSpecies.delete(0, "end")
speciesValues = list()
for (taxid, name) in self.optimizer.speciesList:
speciesValues.append(taxid + ": " + name)
self.comboSourceSpecies["values"] = speciesValues
self.comboTargetSpecies["values"] = speciesValues
if self.comboSourceSpecies.get() not in speciesValues:
self.comboSourceSpecies.set("")
if self.comboTargetSpecies.get() not in speciesValues:
self.comboTargetSpecies.set("")
self.textSourceSeq.edit_modified(True)
self.textResultSequence.edit_modified(True)
self.optimizer.saveConfig("config.ini")
def actionEditSpeciesButton(self, event):
speciesListDialog = SpeciesListDialog(self)
def actionOptimizerSettingsChanged(self, event=None):
# print("Something happened")
strategy = self.comboOptimizationStrategy.get()
sourceString = self.comboSourceSpecies.get()
targetString = self.comboTargetSpecies.get()