grapa.frontend.gui_main.Application

class grapa.frontend.gui_main.Application(master, open_file: str | None = None, config_file: str | None = 'auto')

Bases: Frame

Main Frame for the GUI

__init__(master, open_file: str | None = None, config_file: str | None = 'auto')

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

Methods

__init__(master[, open_file, config_file])

Construct a frame widget with the parent MASTER.

args_to_str(*args, **kwargs)

Format args and kwargs for printing commands in the console

blink_widget(widget, niter[, delay, ...])

Make a widget blink a few times (alternating background color)

call_curve_method(curve, method, *args, **kwargs)

Execute method on active graph[curve], with args and kwargs

call_graph_method(method, *args, **kwargs)

Execute method on currently active graph, with args and kwargs

callback_tab_changed(*_args, **_kwargs)

React to change in tab selection

disable_canvas_callbacks()

Disable the callbacks on the canvas

enable_canvas_callbacks()

Enable the callbacks on the canvas

get_ax()

Return active ax

get_canvas()

Return the canvas

get_clipboard()

returns content of clipboard

get_fig()

Return the Figure

get_file([newvalue])

Get current active file.

get_folder([newvalue])

Get current active folder

get_frame_graph()

Return the Frame containg the graph

get_frame_options()

Return the Frame Options

get_selected_curves([multiple])

Returns a list of unique, sorted indices [idx0, idx1, ...]

get_tab_properties(**kwargs)

Get properties of current active tab.

get_tabs()

Returns the tabs widget

graph([newgraph])

Get current Graph

if_print_commands()

Returns if the checkbox Print Commands is ticked

insert_curve_to_graph(curve[, update_ui])

Appends 1 Curve, or a list of Curves to the active graph

merge_graph(graph)

graph can be a str (filename), or a Graph

open_file(file)

Open a file.

print_last_release()

Retrieve and prints the content of the last release, if recent enough

prompt_file([initialdir, type_, multiple])

Prompts for file open/save

prompt_folder([initialdir])

Prompts for folder open

quit()

Quits application

save_graph(filesave[, fileext, ...])

Saves Graph into a file.

set_auto_screendpi()

Sets the displayed DPI to automatic value

set_clipboard(data)

place new data in the clipboard

store_selected_curves()

Keeps in memory the selected curves.

update_ui()

Update/refresh the GUI

Attributes

DEFAULT_CANVAS_BACKGROUNDCOLOR

DEFAULT_SCREENDPI

static args_to_str(*args, **kwargs)

Format args and kwargs for printing commands in the console

Make a widget blink a few times (alternating background color)

call_curve_method(curve, method, *args, **kwargs)

Execute method on active graph[curve], with args and kwargs

call_graph_method(method, *args, **kwargs)

Execute method on currently active graph, with args and kwargs

callback_tab_changed(*_args, **_kwargs)

React to change in tab selection

disable_canvas_callbacks()

Disable the callbacks on the canvas

enable_canvas_callbacks()

Enable the callbacks on the canvas

get_ax()

Return active ax

get_canvas()

Return the canvas

get_clipboard()

returns content of clipboard

get_fig()

Return the Figure

get_file(newvalue=None)

Get current active file. Also updates folder and title

Parameters:

newvalue – set newvalue for the current active file

get_folder(newvalue=None)

Get current active folder

Parameters:

newvalue – set newvalue for the current active folder

get_frame_graph() GUIFrameCanvasGraph

Return the Frame containg the graph

get_frame_options()

Return the Frame Options

get_selected_curves(multiple=False)

Returns a list of unique, sorted indices [idx0, idx1, …]

get_tab_properties(**kwargs)

Get properties of current active tab.

Parameters:

kwargs – updates the properties of current active tab

get_tabs() GraphsTabManager

Returns the tabs widget

graph(newgraph=None, **kwargs) Graph

Get current Graph

newgraph: to change current Graph. Does NOT refresh interface.

if_print_commands()

Returns if the checkbox Print Commands is ticked

insert_curve_to_graph(curve, update_ui=True)

Appends 1 Curve, or a list of Curves to the active graph

merge_graph(graph)

graph can be a str (filename), or a Graph

open_file(file: str | list | Graph | None)

Open a file.

Paramfile:

a str, or a list of str to open multiple files, or a Graph

static print_last_release()

Retrieve and prints the content of the last release, if recent enough

prompt_file(initialdir='', type_='open', multiple=False, **kwargs)

Prompts for file open/save

prompt_folder(initialdir='')

Prompts for folder open

quit()

Quits application

save_graph(filesave, fileext='', save_altered=False, if_compact=True)

Saves Graph into a file. Separated plot() and export() calls.

Parameters:
  • filesave – str, filename to save the graph

  • fileext – str, image data format (e.g. .png). If ‘’, retrieve preference.

  • save_altered – as per Graph.export(). Default False.

  • if_compact – as per Graph.export(). Default True.

set_auto_screendpi()

Sets the displayed DPI to automatic value

set_clipboard(data)

place new data in the clipboard

store_selected_curves()

Keeps in memory the selected curves. To be called in functions that will call update_ui(), before any action that may change the curves (esp. order, number, new Curves etc. Changes in attributes should be safe)

update_ui()

Update/refresh the GUI