module funcwin.frame_function

Inheritance diagram of tkinterquickhelper.funcwin.frame_function

Short summary

module tkinterquickhelper.funcwin.frame_function

FrameFunction

source on GitHub

Classes

class truncated documentation
FrameFunction Creating a Frame window for a function. It will create an entry control for every parameter. If one of the parameter …
FrameFunction_ThreadFunction Class associated to FrameFunction, it runs the function in a separate thread (in order to be able to stop its execution …

Functions

function truncated documentation
open_window_function Opens a tkinter window to run a function. It adds entries for the parameters, it displays the help associated …

Properties

property truncated documentation
_windowingsystem Internal function.
daemon A boolean value indicating whether this thread is a daemon thread. This must be set before start() is called, otherwise …
ident Thread identifier of this thread or None if it has not been started. This is a nonzero integer. See the get_ident() …
name A string used for identification purposes only. It has no semantics. Multiple threads may be given the same name. …

Static Methods

staticmethod truncated documentation
open_window Opens a tkinter window to run a function. It adds entries for the parameters, it displays the help associated …

Methods

method truncated documentation
__init__  
__init__ constructor
destroy Stops the thread and destroy the function. The behaviour of method Thread._stop
get_parameters Returns the parameters in a dictionary.
get_title  
history_down Looks forward in the history of used parameters and change the parameters.
history_up Looks back in the history of used parameters and change the parameters.
refresh Refreshes the screen.
run run the thread
run_cancel cancel
run_function Runs the function.
stop_thread Stops the function execution.
update Updates the parameters (ie self.info).

Documentation

FrameFunction

source on GitHub

class tkinterquickhelper.funcwin.frame_function.FrameFunction(parent, function, restore=True, width=100, raise_exception=False, overwrite=None, hide=False, command_leave=None, key_save='e')[source][source]

Bases: tkinter.Frame

Creating a Frame window for a function. It will create an entry control for every parameter. If one of the parameter is ‘password’, the window will show only stars. The windows proposes to store the value and to restore them on the next call. This functionality is disable when ‘password’ is present in the list of parameters.

source on GitHub

Parameters:
  • parent – window parent
  • function – function object (can be a string)
  • restore – if True, check if existing saved parameters are present
  • width – number of characters in every Entry field
  • raise_exception – raise an exception instead of catching it
  • overwrite – parameters to overwrite
  • hide – if True, hide the window after clicking on OK
  • command_leave – if not None, this function will be called when clicking on Cancel or Leave
  • key_save – suffix to add to the filename used to store parameters

source on GitHub

__init__(parent, function, restore=True, width=100, raise_exception=False, overwrite=None, hide=False, command_leave=None, key_save='e')[source][source]
Parameters:
  • parent – window parent
  • function – function object (can be a string)
  • restore – if True, check if existing saved parameters are present
  • width – number of characters in every Entry field
  • raise_exception – raise an exception instead of catching it
  • overwrite – parameters to overwrite
  • hide – if True, hide the window after clicking on OK
  • command_leave – if not None, this function will be called when clicking on Cancel or Leave
  • key_save – suffix to add to the filename used to store parameters

source on GitHub

destroy()[source][source]

Stops the thread and destroy the function. The behaviour of method Thread._stop changed in Python 3.4, See the discussion.

source on GitHub

get_parameters()[source][source]

Returns the parameters in a dictionary.

Returns:dictionary

source on GitHub

get_title()[source][source]
Returns:self.info [“name”]

source on GitHub

history_down(*args)[source][source]

Looks forward in the history of used parameters and change the parameters.

source on GitHub

history_up(*args)[source][source]

Looks back in the history of used parameters and change the parameters.

source on GitHub

static open_window(func, top_level_window=None, params=None, key_save='f', do_not_open=False)[source][source]

Opens a tkinter window to run a function. It adds entries for the parameters, it displays the help associated to this function, and it allows use to run the function in a window frame. Logs are also displayed. It also memorizes the latest values used (stored in <user>/TEMP folder).

Parameters:
  • func – function (function object)
  • top_level_window – if you want this window to depend on a top level window from tkinter
  • params – if not None, overwrite values for some parameters
  • key_save – suffix added to the file used to store the parameters
  • do_not_open – if True, the function do not open the window but returns it
Returns:

None or windows if do_not_open is True

The window looks like:

../../_images/open_window_function.png

Example:

FrameFunction.open_window (file_head)

New in version 1.0: Parameter do_not_open was added.

source on GitHub

refresh()[source][source]

Refreshes the screen.

source on GitHub

run_cancel(*args)[source][source]

cancel

source on GitHub

run_function(*args)[source][source]

Runs the function.

source on GitHub

stop_thread()[source][source]

Stops the function execution.

source on GitHub

update()[source][source]

Updates the parameters (ie self.info).

source on GitHub

class tkinterquickhelper.funcwin.frame_function.FrameFunction_ThreadFunction(framewindow, parameter)[source][source]

Bases: threading.Thread

Class associated to FrameFunction, it runs the function in a separate thread (in order to be able to stop its execution from the interface).

source on GitHub

constructor

source on GitHub

__init__(framewindow, parameter)[source][source]

constructor

source on GitHub

run()[source][source]

run the thread

source on GitHub

tkinterquickhelper.funcwin.frame_function.open_window_function(func, top_level_window=None, params=None, key_save='f', do_not_open=False)[source][source]

Opens a tkinter window to run a function. It adds entries for the parameters, it displays the help associated to this function, and it allows use to run the function in a window frame. Logs are also displayed. It also memorizes the latest values used (stored in <user>/TEMP folder).

Parameters:
  • func – function (function object)
  • top_level_window – if you want this window to depend on a top level window from tkinter
  • params – if not None, overwrite values for some parameters
  • key_save – suffix added to the file used to store the parameters
  • do_not_open – if True, the function do not open the window but returns it
Returns:

None or windows if do_not_open is True

The window looks like:

../../_images/open_window_function.png

Open a tkinter windows to run a function::

open_window_function (test_regular_expression)

The functions opens a window which looks like the following one:

../../_images/open_function.png

The parameters key_save can be ignored but if you use this function with different parameters, they should all appear after a couple of runs. That is because the function uses key_save ot unique the file uses to store the values for the parameters used in previous execution.

New in version 1.0: Parameter do_not_open was added.

source on GitHub