In tkinter there are some functions to open the standard system dialog boxes, grouped in some submodules which you must import if you want to use them. In Nictk (since version 2.1.1) I imported the function names with from ... import ..., so you can use them prepending only the Nictk prefix. For compatibility with older versions you can still call them with older prefixes (this will be dropped in future versions).
For an example of their use see the file Dialogs.py.
All these functions share the same paradigm:
where:
Here is a list of them with their name in Nictk.
Function | Notes | Returns |
---|---|---|
Nictk.askokcancel | Opens a dialog box with tho buttons "Ok", "Cancel". | True for "Ok" and False for "Cancel". |
Nictk.askquestion | Opens a dialog box with two buttons "Yes", "No". | "yes" or "no" (aliased by YES, NO). |
Nictk.askretrycancel | Opens a dialog box with two buttons "Retry", "Cancel". | True for "Retry" and False for "Cancel". |
Nictk.askyesno | Same of askquestion. | True for "Yes" and False for "No". |
Nictk.askyesnocancel | Opens a dialog box with three buttons "Yes", "No", "Cancel". | True for "Yes", False for "No", None for "Cancel". |
Nictk.showerror | Opens a dialog box with an error icon and only the button "Ok". | Always "ok" (aliased by OK). |
Nictk.showinfo | Opens a dialog box with an info icon and only the button "Ok". | As above. |
Nictk.showwarning | Opens a dialog box with a warning icon and only the button "Ok". | As above. |
All these functions share the same paradigm:
For the options parameters see here.
Here is a list of them with their name in Nictk.
Function | Notes | Returns |
---|---|---|
Nictk.askopenfilename | Opens the file dialog "Open file" where you can choose a file. | The complete path of the chosen file, or an empty string if you press "Cancel". |
Nictk.asksaveasfilename | Opens the file dialog "Save as file" where you can choose a file. | The complete path of the chosen file, or an empty string if you press "Cancel". |
Nictk.askopenfilenames | Opens the file dialog "Open file" where you can choose multiple files. | A list with complete paths of the chosen files, or an empty list if you press "Cancel". |
Nictk.askdirectory | Opens the file dialog "Open file" where you can choose a directory. | The complete path of the chosen directory, or an empty string if you press "Cancel". |
There is only one:
where:
Function | Notes | Returns |
---|---|---|
Nictk.askcolor | Opens a color chooser file dialog. | A duple, with in the first element three integers R, G, B, in the second a tkinter Color object, or (None, None) if you press "Cancel" |