From d8320031a3b03d43aff6581c3e099eab1b32f942 Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Mon, 12 Aug 2019 06:44:24 +0200 Subject: [PATCH] examples for dialogs --- .gitignore | 1 + example_006.py | 12 ++++++++++++ example_007.py | 10 ++++++++++ example_008.py | 19 +++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 example_006.py create mode 100644 example_007.py create mode 100644 example_008.py diff --git a/.gitignore b/.gitignore index 6a18ad4..e3c57e5 100644 --- a/.gitignore +++ b/.gitignore @@ -94,3 +94,4 @@ ENV/ # Rope project settings .ropeproject +*.png diff --git a/example_006.py b/example_006.py new file mode 100644 index 0000000..478095d --- /dev/null +++ b/example_006.py @@ -0,0 +1,12 @@ +# example_006.py +from tkinter.filedialog import askopenfilename + +def main(): + filename = askopenfilename(title='Markdown öffnen', + filetypes=[('Markdown', '*.md'), + ('Compressed Markdown', '*.md.zip')], + initialdir='.') + print(filename) + +if __name__ == '__main__': + main() diff --git a/example_007.py b/example_007.py new file mode 100644 index 0000000..8e8fd49 --- /dev/null +++ b/example_007.py @@ -0,0 +1,10 @@ +# example_007.py +from tkinter.messagebox import showinfo, showwarning, showerror + +def main(): + showinfo('Information (Titel)', 'Information (Nachricht)') + showwarning('Warnung (Titel)', 'Warnung (Nachricht)') + showerror('Fehler (Titel)', 'Fehler (Nachricht)') + +if __name__ == '__main__': + main() diff --git a/example_008.py b/example_008.py new file mode 100644 index 0000000..31e2c20 --- /dev/null +++ b/example_008.py @@ -0,0 +1,19 @@ +# example_008.py +from tkinter.messagebox import askokcancel, askquestion, askretrycancel, askyesno, askyesnocancel + + +def main(): + response = askokcancel('askokcancel (Titel)', 'askokcancel (Nachricht)') + print(response) + response = askquestion('askquestion (Titel)', 'askquestion (Nachricht)') + print(response) + response = askretrycancel('askretrycancel (Titel)', 'askretrycancel (Nachricht)') + print(response) + response = askyesno('askyesno (Titel)', 'askyesno (Nachricht)') + print(response) + response = askyesnocancel('askyesnocancel (Titel)', 'askyesnocancel (Nachricht)') + print(response) + + +if __name__ == '__main__': + main()