module funcwin.frame_params

Inheritance diagram of tkinterquickhelper.funcwin.frame_params

Short summary

module tkinterquickhelper.funcwin.frame_params

Defines FrameParams.

source on GitHub

Classes

class

truncated documentation

FrameParams

Creates a Frame window for a list of parameters.

Functions

function

truncated documentation

open_window_params

Open a tkinter window to set up parameters. It adds entries for the parameters, it displays the help given …

Properties

property

truncated documentation

_windowingsystem

Internal function.

Static Methods

staticmethod

truncated documentation

open_window

Opens a tkinter window to set up parameters. It adds entries for the parameters, it displays the …

Methods

method

truncated documentation

__init__

get_parameters

returns the parameters

get_title

Returns the title.

history_down

look forward in the history (log of used parameters) and update the parameters

history_up

look back in the history (log of used parameters) and update the parameters

refresh

Refreshes the screen.

run_cancel

what to do when Cancel is pressed

run_function

Runs the function.

update

update the parameters (ie self.info)

Documentation

Defines FrameParams.

source on GitHub

class tkinterquickhelper.funcwin.frame_params.FrameParams(parent, restore=True, width=100, raise_exception=False, params=None, help='', key_save='', command_leave=None)[source]

Bases: tkinter.Frame

Creates a Frame window for a list of parameters.

source on GitHub

Parameters
  • parent – window parent

  • 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

  • params – parameters to overwrite

  • help – help to display

  • key_save – to make unique the file storing and restoring the parameters

  • command_leave – if not None, this function will be called when clicking on Cancel or Leave

source on GitHub

__init__(parent, restore=True, width=100, raise_exception=False, params=None, help='', key_save='', command_leave=None)[source]
Parameters
  • parent – window parent

  • 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

  • params – parameters to overwrite

  • help – help to display

  • key_save – to make unique the file storing and restoring the parameters

  • command_leave – if not None, this function will be called when clicking on Cancel or Leave

source on GitHub

get_parameters()[source]

returns the parameters

Returns

dictionary

source on GitHub

get_title()[source]

Returns the title.

Returns

self.info ["name"]

source on GitHub

history_down(*args)[source]

look forward in the history (log of used parameters) and update the parameters

source on GitHub

history_up(*args)[source]

look back in the history (log of used parameters) and update the parameters

source on GitHub

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

Opens a tkinter window to set up parameters. It adds entries for the parameters, it displays the help given to this function. It also memorizes the latest values used (stored in <user>/TEMP folder).

Parameters
  • help_string – help to de displayed

  • 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, it will be updated by the function (= returned value)

  • key_save – parameters are saved and restore from a file, key_save will make this file unique

  • title – title of the window

  • do_not_open – do not open the window, let you do it

Returns

new parameters (or a the Windows object if do_not_open is True)

Warning

If the string “__cancel__” is present in the results, it means the users clicked on cancel.

The window looks like:

../../_images/open_window_params.png

Example:

params =  {"velib_key": "", "contract":"Paris"}
newparams = FrameParams.open_window (params, "fetch data from Velib website")

Changed in version 1.0: Parameter do_not_open was added.

source on GitHub

refresh()[source]

Refreshes the screen.

source on GitHub

run_cancel(*args)[source]

what to do when Cancel is pressed

source on GitHub

run_function(*args)[source]

Runs the function.

source on GitHub

update()[source]

update the parameters (ie self.info)

source on GitHub

tkinterquickhelper.funcwin.frame_params.open_window_params(params, help_string='', title='', top_level_window=None, key_save='', do_not_open=False)[source]

Open a tkinter window to set up parameters. It adds entries for the parameters, it displays the help given to this function. It also memorizes the latest values used (stored in <user>/TEMP folder).

Parameters
  • help_string – help to de displayed

  • 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, it will be updated by the function (= returned value)

  • key_save – parameters are saved and restore from a file, key_save will make this file unique

  • title – title of the window

  • do_not_open – do not open the window, let you do it

Returns

new parameters (or a the Windows object if do_not_open is True)

Warning

If the string “__cancel__” is present in the results, it means the users clicked on cancel.

The window looks like:

../../_images/open_window_params.png

Open a tkinter window to ask parameters to a user

params = { "user": os.environ.get("USERNAME", os.environ["USER"]),
        "password":"" }
newparams = open_window_params(params, title="try the password *",
                               help_string="unit test", key_save="my_key")

The program opens a window like the following one:

../../_images/open_params.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.

Password are not stored in a text file. You must type them again next time.

source on GitHub