def create_combobox(master, row, column, values, class_type='string', readonly=True, width=COMBOBOX_WIDTH, required=False, default=None, valid_check=None, error_msg=None, rowspan=1, columnspan=1, padx=PADX, pady=PADY, sticky='W'): combobox = ttk.Combobox(master=master, values=values, state='readonly' if readonly else None, width=width, justify='right') combobox.grid(row=row, column=column, rowspan=rowspan, columnspan=columnspan, padx=padx, pady=pady, sticky=sticky) return get_entry(class_type, combobox, required=required, default=default, readonly=readonly, valid_check=valid_check, error_msg=error_msg)
def create_labeled_entry(master, row, column, text, class_type, width=ENTRY_WIDTH, required=False, required_mark=True, default=None, valid_check=None, error_msg=None, rowspan=1, columnspan=1, padx=PADX, pady=PADY, sticky='EW', return_label=False): frame = create_frame(master, row, column, rowspan, columnspan, padx, pady, sticky) grid_configure(frame, [0], [0, 1]) label_text = text + ' (*): ' if required and required_mark else text + ': ' label = tk.Label(master=frame, text=label_text) label.grid(row=0, column=0, sticky='W') entry = tk.Entry(master=frame, width=width, justify='right') entry.grid(row=0, column=1, sticky='E') entry = get_entry(class_type, entry, required=required, default=default, valid_check=valid_check, error_msg=error_msg) if return_label: return label, entry else: return entry
def create_entry(master, row, column, class_type, width=ENTRY_WIDTH, required=False, default=None, valid_check=None, error_msg=None, rowspan=1, columnspan=1, padx=PADX, pady=PADY, sticky='W'): entry = tk.Entry(master=master, width=width, justify='right') entry.grid(row=row, column=column, rowspan=rowspan, columnspan=columnspan, padx=padx, pady=pady, sticky=sticky) return get_entry(class_type, entry, required=required, default=default, valid_check=valid_check, error_msg=error_msg)
def create_labeled_button_entry(master, row, column, label_text, button_text, command=None, width=ENTRY_WIDTH, required=False, required_mark=True, default=None, valid_check=None, error_msg=None, rowspan=1, columnspan=1, padx=PADX, pady=PADY, sticky='NSEW', return_label=False): frame = create_frame(master, row, column, rowspan, columnspan, 0, pady / 2, sticky) grid_configure(frame, [0], [1]) label_text = label_text + ' (*): ' if required and required_mark else label_text + ': ' label = tk.Label(master=frame, text=label_text) label.grid(row=0, column=0, columnspan=2, sticky='W', padx=padx, pady=pady / 2) button = Button(master=frame, text=button_text, command=command) button.grid(row=1, column=0, padx=padx) entry = tk.Entry(master=frame, width=width, justify='right') entry.grid(row=1, column=1, sticky='EW', padx=padx) entry = get_entry('string', entry, required=required, default=default, valid_check=valid_check, error_msg=error_msg) if return_label: return label, button, entry else: return button, entry
def create_labeled_combobox(master, row, column, text, values=None, class_type='string', readonly=True, width=COMBOBOX_WIDTH, justify='right', required=False, required_mark=True, default=None, valid_check=None, error_msg=None, rowspan=1, columnspan=1, padx=PADX, pady=PADY, sticky='NSEW', return_label=False): frame = create_frame(master, row, column, rowspan, columnspan, padx, pady, sticky) grid_configure(frame, [0], [0, 1]) label_text = text + ' (*): ' if required and required_mark else text + ': ' label = tk.Label(master=frame, text=label_text) label.grid(row=0, column=0, sticky='W') combobox = ttk.Combobox(master=frame, values=values, state='readonly' if readonly else None, width=width, justify=justify) combobox.grid(row=0, column=1, sticky='E') entry = get_entry(class_type, combobox, required=required, default=default, readonly=readonly, valid_check=valid_check, error_msg=error_msg) if return_label: return label, entry else: return entry
def create_text(master, row, column, width=TEXT_WIDTH, height=TEXT_HEIGHT, rowspan=1, columnspan=1, padx=PADX, pady=PADY, sticky='NSEW'): frame = create_frame(master, row, column, rowspan, columnspan, padx, pady, sticky) grid_configure(frame, 0, 0) scrtext = scrolledtext.ScrolledText(master=frame, width=width, height=height) scrtext.grid(row=0, column=0, sticky='NSEW') entry = get_entry('string', scrtext) return entry