本文整理汇总了Python中TkUtil.set_combobox_item方法的典型用法代码示例。如果您正苦于以下问题:Python TkUtil.set_combobox_item方法的具体用法?Python TkUtil.set_combobox_item怎么用?Python TkUtil.set_combobox_item使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TkUtil
的用法示例。
在下文中一共展示了TkUtil.set_combobox_item方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_widgets
# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import set_combobox_item [as 别名]
def create_widgets(self):
self.sourceLabel = ttk.Label(self, text="Source Folder:",
underline=-1 if TkUtil.mac() else 1)
self.sourceEntry = ttk.Entry(self, width=30,
textvariable=self.sourceText)
self.sourceButton = TkUtil.Button(self, text="Source...",
underline=0, command=lambda *args:
self.choose_folder(SOURCE))
self.helpButton = TkUtil.Button(self, text="Help", underline=0,
command=self.help)
self.targetLabel = ttk.Label(self, text="Target Folder:",
underline=-1 if TkUtil.mac() else 1)
self.targetEntry = ttk.Entry(self, width=30,
textvariable=self.targetText)
self.targetButton = TkUtil.Button(self, text="Target...",
underline=0, command=lambda *args:
self.choose_folder(TARGET))
self.aboutButton = TkUtil.Button(self, text="About", underline=1,
command=self.about)
self.statusLabel = ttk.Label(self, textvariable=self.statusText)
self.scaleButton = TkUtil.Button(self, text="Scale",
underline=1, command=self.scale_or_cancel,
default=tk.ACTIVE, state=tk.DISABLED)
self.quitButton = TkUtil.Button(self, text="Quit", underline=0,
command=self.close)
self.dimensionLabel = ttk.Label(self, text="Max. Dimension:",
underline=-1 if TkUtil.mac() else 6)
self.dimensionCombobox = ttk.Combobox(self,
textvariable=self.dimensionText, state="readonly",
values=("50", "100", "150", "200", "250", "300", "350",
"400", "450", "500"))
TkUtil.set_combobox_item(self.dimensionCombobox, "400")
示例2: populate_comboboxes
# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import set_combobox_item [as 别名]
def populate_comboboxes(self):
currencies = sorted(self.rates.keys())
for combobox in (self.currencyFromCombobox, self.currencyToCombobox):
combobox.state(("readonly",))
combobox.config(values=currencies)
TkUtil.set_combobox_item(self.currencyFromCombobox, "USD", True)
TkUtil.set_combobox_item(self.currencyToCombobox, "GBP", True)
self.calculate()
示例3: create_view_toolbar
# 需要导入模块: import TkUtil [as 别名]
# 或者: from TkUtil import set_combobox_item [as 别名]
def create_view_toolbar(self):
settings = TkUtil.Settings.Data
self.viewToolbar = ttk.Frame(self.toolbarFrame, relief=tk.RAISED)
self.viewToolbar.text = FORMAT_TOOLBAR
self.viewToolbar.underline = 1
menuButton = ttk.Button(self.viewToolbar,
text="Format Toolbar Menu",
image=self.toolbarImages[TOOLBARMENU],
command=self.toolbar_menu)
TkUtil.bind_context_menu(menuButton, self.toolbar_menu)
TkUtil.Tooltip.Tooltip(menuButton, text="Format Toolbar Menu")
self.fontFamilyCombobox = ttk.Combobox(self.viewToolbar,
width=15, textvariable=self.fontFamily,
state="readonly", values=TkUtil.font_families())
self.fontFamilyCombobox.bind("<<ComboboxSelected>>",
self.update_font)
TkUtil.set_combobox_item(self.fontFamilyCombobox,
self.fontFamily.get())
TkUtil.Tooltip.Tooltip(self.fontFamilyCombobox, text="Font Family")
self.fontSizeSpinbox = Spinbox(self.viewToolbar, width=2,
textvariable=self.fontPointSize, from_=6, to=72,
justify=tk.RIGHT, validate="all")
self.fontSizeSpinbox.config(validatecommand=(
self.fontSizeSpinbox.register(self.validate_int),
"fontSizeSpinbox", "%P"))
TkUtil.Tooltip.Tooltip(self.fontSizeSpinbox,
text="Font Point Size")
self.boldButton = ttk.Button(self.viewToolbar,
text=BOLD, image=self.toolbarImages[BOLD])
self.boldButton.config(
command=lambda: self.toggle_button(self.boldButton,
self.bold))
TkUtil.Tooltip.Tooltip(self.boldButton, text=BOLD)
self.italicButton = ttk.Button(self.viewToolbar,
text=ITALIC,
image=self.toolbarImages[ITALIC])
self.italicButton.config(
command=lambda: self.toggle_button(self.italicButton,
self.italic))
TkUtil.Tooltip.Tooltip(self.italicButton, text=ITALIC)
TkUtil.add_toolbar_buttons(self.viewToolbar, (menuButton,
self.fontFamilyCombobox, self.fontSizeSpinbox,
self.boldButton, self.italicButton))
self.toolbars.append(self.viewToolbar)