Makes a window into a "Modal Window" This means user will not be able to interact with other windows until this one is closed NOTE - Sorry Mac users - you can't have modal windows.... lobby your tkinter Mac devs
(self)
| 12121 | self.TKroot.wm_title(str(title)) |
| 12122 | |
| 12123 | def make_modal(self): |
| 12124 | """ |
| 12125 | Makes a window into a "Modal Window" |
| 12126 | This means user will not be able to interact with other windows until this one is closed |
| 12127 | |
| 12128 | NOTE - Sorry Mac users - you can't have modal windows.... lobby your tkinter Mac devs |
| 12129 | """ |
| 12130 | if not self._is_window_created('tried Window.make_modal'): |
| 12131 | return |
| 12132 | |
| 12133 | if running_mac() and ENABLE_MAC_MODAL_DISABLE_PATCH: |
| 12134 | return |
| 12135 | |
| 12136 | # if modal windows have been disabled globally |
| 12137 | if not DEFAULT_MODAL_WINDOWS_ENABLED and not DEFAULT_MODAL_WINDOWS_FORCED: |
| 12138 | # if not DEFAULT_MODAL_WINDOWS_ENABLED: |
| 12139 | return |
| 12140 | |
| 12141 | try: |
| 12142 | self.TKroot.transient() |
| 12143 | self.TKroot.grab_set() |
| 12144 | self.TKroot.focus_force() |
| 12145 | except Exception as e: |
| 12146 | print('Exception trying to make modal', e) |
| 12147 | |
| 12148 | def force_focus(self): |
| 12149 | """ |
no test coverage detected