File: alerts.py

package info (click to toggle)
python-guizero 0.6.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,820 kB
  • sloc: python: 5,376; makefile: 28; sh: 17
file content (58 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from tkinter import messagebox
# Generates alerts


def warn(title, text):
    """
    Display a warning message box.

    :param string title:
        The title to be displayed on the box.
    :param string text:
        The text to be displayed on the box.
    :return:
        None.
    """
    messagebox.showwarning(title, text)


def info(title, text):
    """
    Display an info message box.

    :param string title:
        The title to be displayed on the box.
    :param string text:
        The text to be displayed on the box.
    :return:
        None.
    """
    messagebox.showinfo(title, text)


def error(title, text):
    """
    Display an error message box.

    :param string title:
        The title to be displayed on the box.
    :param string text:
        The text to be displayed on the box.
    :return:
        None.
    """
    messagebox.showerror(title, text)


def yesno(title, text):
    """
    Alert type yes or no

    :param string title:
        The title to be displayed on the box.
    :param string text:
        The text to be displayed on the box.
    :return:
        True if 'yes', False if 'no'
    """
    return messagebox.askyesno(title, text)