fitspy.app.utils module
utilities functions related to Tkinter
- fitspy.app.utils.add(obj, row, col, sticky='', padx=5, pady=3, rspan=1, cspan=1, **kwargs)
Add tkinter object at the (row, col)-position of a grid
- fitspy.app.utils.add_entry(frame, row, label, val, width=5, bind_fun=None)
Add 2 columns : ‘label’ and ‘val’ associated to a binding function ‘bind_fun’ at ‘row’ (int) position in a ‘frame’ (Tk.Frame)
- fitspy.app.utils.interactive_entry(root, var, fun, width=2)
Return an interactive Tkinter.Entry binded to ‘fun’
- fitspy.app.utils.dict_has_tk_variable(dictionary)
Return ‘True’ if ‘dictionary’ has Tkinter.Variable as value
- fitspy.app.utils.convert_dict_from_tk_variables(parent_dict, excluded_keys=None)
Convert a dictionary from Tkinter.Variables to standard types (thanks to a recursive processing)
- class fitspy.app.utils.ToggleFrame(master, exceptions=None, **kwargs)
Bases:
LabelFrame
Class dedicated to Enable/Disable LabelFrame and its related children
Construct a labelframe widget with the parent MASTER.
STANDARD OPTIONS
borderwidth, cursor, font, foreground, highlightbackground, highlightcolor, highlightthickness, padx, pady, relief, takefocus, text
WIDGET-SPECIFIC OPTIONS
background, class, colormap, container, height, labelanchor, labelwidget, visual, width
- apply_state(state, parent=None)
Apply state ‘disable’ or ‘normal’ to Frame’s children widgets
- disable()
Disable Frame’s children widgets
- enable()
Enable Frame’s children widgets
- class fitspy.app.utils.ScrollbarFrame(root, orientation='both')
Bases:
object
Class to add a vertical and/or horziontal Scrollbar to a frame. (Strongly inspired from https://stackoverflow.com/questions/43731784)
- frame_canvas
Frame gathers the ‘Canvas’ and the ‘Scrollbar’ objects
- Type:
Tkinter.Frame
- canvas
Canvas related to the first (large) row-column
- Type:
Tkinter.Canvas
- vsbar
Vertical scrollbar related to the 2nd (small) column, if ‘orientation’ is ‘vertical’ or ‘both’
- Type:
Tkinter.Scrollbar
- hsbar
Horizontal scrollbar related to the 2nd (small) row if ‘orientation’ is ‘horizontal’ or ‘both’
- Type:
Tkinter.Scrollbar
- frame
Frame included in the canvas, where other frames can be stacked
- Type:
Tkinter.Frame
- Parameters:
root (Tkinter parent window) –
orientation (str, optional) – Orientation associated to the scrollbar(s), among [‘vertical’, ‘horizontal’, ‘both’]
- update_and_resize(width=None, height=None)
Set the scrolling region with the ‘correct’ size
- Parameters:
width (int, optional) – Width of the canvas frame. If None, consider the ‘frame’ width.
height (int, optional) – height of the canvas frame. If None, consider the minimum between the frame height and 90% of the screen height
- class fitspy.app.utils.FilesSelector(root, ninputs=1, files_extensions='*.txt', dirname_results='DEFAULT', lbox_size=None, options=None, tab_options=None)
Bases:
object
Class dedicated to the files selection
- ninputs
Number of inputs to consider
- Type:
int
- lbox
List of ‘ninputs’-Listbox associated to the selected files
- Type:
list of Listbox object
- filenames
List of ‘ninputs’-list of filenames to work with
- Type:
list of str
- files_extension
Extension used for the files selection
- Type:
iterable of str
- self.dirname_res
Directory pathname where to find results associated to the files
- Type:
str
- Parameters:
root (Tk.widget) – The main window associated to the FileSelector
ninputs (int, optional) – Number of inputs to consider
files_extensions (str, optional) – Extension used for files selection.
dirname_results (str, optional) – Directory pathname where to find results associated to the files ‘DEFAULT’ value refers to ‘./results’ directory associated to the ‘file’ location
lbox_size (list of 2 ints, optional) – Size (width, height) of the Listbox ‘lbox’. Default value is [30, 15]
options (dict, optional) – Dictionary of options
tab_options (Frame object) – Tab dedicated to options parameters settings
- set_options()
Set files options
- synchronize()
Cursor selection synchronization between Listbox
- move(key)
Move cursor selection according to key value (up or down)
- add_items(i=0, filenames=None, ind_start=None)
Add items from a ‘filenames’ list
- select_files(i=0, filenames=None)
Add items from selected files
- select_dir(i=0, dirname=None)
Add items from a directory
- remove(i=0)
Remove selected items
- remove_all(i=0)
Remove all items