forked from AllenDowney/ThinkPython
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPopup.py
More file actions
28 lines (20 loc) · 687 Bytes
/
Popup.py
File metadata and controls
28 lines (20 loc) · 687 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
"""This module is part of an exercise for
Think Python: an Introduction to Software Design
Copyright 2011 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import sys
from swampy.Gui import Gui
class Popup(Gui):
"""Creates a top-level window with a message."""
def __init__(self, message, sender):
Gui.__init__(self)
self.title('Popup')
self.la(text='From: %s' % sender)
self.la(text=message)
self.bu(text='Close', command=self.destroy)
self.mainloop()
def main(script, message='default message', sender='unknown', *args):
Popup(message, sender)
if __name__ == '__main__':
main(*sys.argv)