Return the singleton SearchEngine instance for the process. The single SearchEngine saves settings between dialog instances. If there is not a SearchEngine already, make one.
(root)
| 5 | from tkinter import messagebox |
| 6 | |
| 7 | def get(root): |
| 8 | '''Return the singleton SearchEngine instance for the process. |
| 9 | |
| 10 | The single SearchEngine saves settings between dialog instances. |
| 11 | If there is not a SearchEngine already, make one. |
| 12 | ''' |
| 13 | if not hasattr(root, "_searchengine"): |
| 14 | root._searchengine = SearchEngine(root) |
| 15 | # This creates a cycle that persists until root is deleted. |
| 16 | return root._searchengine |
| 17 | |
| 18 | |
| 19 | class SearchEngine: |