module funcwin.frame_params
¶
Short summary¶
module tkinterquickhelper.funcwin.frame_params
Defines FrameParams
.
Classes¶
class |
truncated documentation |
---|---|
Creates a Frame window for a list of parameters. |
Functions¶
function |
truncated documentation |
---|---|
Open a tkinter window to set up parameters. It adds entries for the parameters, it displays the help given … |
Properties¶
property |
truncated documentation |
---|---|
|
Internal function. |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Opens a tkinter window to set up parameters. It adds entries for the parameters, it displays the … |
Methods¶
method |
truncated documentation |
---|---|
returns the parameters |
|
Returns the title. |
|
look forward in the history (log of used parameters) and update the parameters |
|
look back in the history (log of used parameters) and update the parameters |
|
Refreshes the screen. |
|
what to do when Cancel is pressed |
|
Runs the function. |
|
update the parameters (ie |
Documentation¶
Defines FrameParams
.
- class tkinterquickhelper.funcwin.frame_params.FrameParams(parent, restore=True, width=100, raise_exception=False, params=None, help='', key_save='', command_leave=None)[source]¶
Bases:
Frame
Creates a Frame window for a list of parameters.
- 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
- __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
- history_down(*args)[source]¶
look forward in the history (log of used parameters) and update the parameters
- history_up(*args)[source]¶
look back in the history (log of used parameters) and update the parameters
- 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:
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.
- 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:
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:
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 useskey_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.