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")
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()
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()
def populate_comboboxes(self): currencies = sorted(self.rates.keys()) for combobox in (self.currency_from_combobox, self.currency_to_combobox): combobox.state(("readonly", )) combobox.config(value=currencies) TkUtil.set_combobox_item(self.currency_from_combobox, "test") TkUtil.set_combobox_item(self.currency_to_combobox, "test2") self.calculate()
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")
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)
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)