-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathErrorDialog.py
More file actions
31 lines (23 loc) · 1009 Bytes
/
ErrorDialog.py
File metadata and controls
31 lines (23 loc) · 1009 Bytes
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
from MasyuDialog import *
import tkinter as tk
# Generic error dialog; subclassed from MasyuDialog, so that it
# inherits the general behavior we want.
class ErrorDialog(MasyuDialog):
# Class constructor
def __init__(self, parentWindow):
super().__init__(parentWindow)
self.__topLevel = None
def okHandler(self):
self.__topLevel.destroy()
def showDialog(self, title, message):
toplevel = tk.Toplevel()
toplevel.resizable(0, 0)
self.__topLevel = toplevel
toplevel.title(title)
l1 = tk.Label(toplevel, image="::tk::icons::error")
l1.grid(row=0, column=0, pady=(7, 0), padx=(10, 30), sticky="e")
l2 = tk.Label(toplevel, text=message)
l2.grid(row=0, column=1, columnspan=4, padx=(0, 30), pady=(7, 10), sticky="w")
b2 = tk.Button(toplevel, text="OK", command=self.okHandler, width=10)
b2.grid(row=1, column=2, padx=(2, 35), pady=(0, 15), sticky="e")
super().showDialog(toplevel)