examples for dialogs

This commit is contained in:
Joachim Lusiardi 2019-08-12 06:44:24 +02:00
parent 0564517d70
commit d8320031a3
4 changed files with 42 additions and 0 deletions

1
.gitignore vendored
View File

@ -94,3 +94,4 @@ ENV/
# Rope project settings # Rope project settings
.ropeproject .ropeproject
*.png

12
example_006.py Normal file
View File

@ -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()

10
example_007.py Normal file
View File

@ -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()

19
example_008.py Normal file
View File

@ -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()