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.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, lbox_size=None)

Bases: object

Class dedicated to the files selection

lbox

Listbox associated to the selected files

Type:

list of Listbox object

filenames

List of of filenames to work with

Type:

list of str

Parameters:
  • root (Tk.widget) – The main window associated to the FileSelector

  • lbox_size (list of 2 ints, optional) – Size (width, height) of the Listbox ‘lbox’. Default value is [30, 15]

move(key)

Move cursor selection according to key value (up or down)

add_items(filenames=None, ind_start=None)

Add items from a ‘filenames’ list

select_files(filenames=None)

Add items from selected files

select_dir(dirname=None)

Add items from a directory

remove()

Remove selected items

remove_all()

Remove all items

select_item(index, selection_clear=True)

Select item in the listbox