MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / enable_tk

Method enable_tk

pydev_ipython/inputhook.py:290–320  ·  view source on GitHub ↗

Enable event loop integration with Tk. Parameters ---------- app : toplevel :class:`Tkinter.Tk` widget, optional. Running toplevel widget to use. If not given, we probe Tk for an existing one, and create a new one if none is found. Notes

(self, app=None)

Source from the content-addressed store, hash-verified

288 self.clear_inputhook()
289
290 def enable_tk(self, app=None):
291 """Enable event loop integration with Tk.
292
293 Parameters
294 ----------
295 app : toplevel :class:`Tkinter.Tk` widget, optional.
296 Running toplevel widget to use. If not given, we probe Tk for an
297 existing one, and create a new one if none is found.
298
299 Notes
300 -----
301 If you have already created a :class:`Tkinter.Tk` object, the only
302 thing done by this method is to register with the
303 :class:`InputHookManager`, since creating that object automatically
304 sets ``PyOS_InputHook``.
305 """
306 self._current_gui = GUI_TK
307 if app is None:
308 try:
309 import Tkinter as _TK
310 except:
311 # Python 3
312 import tkinter as _TK # @UnresolvedImport
313 app = _TK.Tk()
314 app.withdraw()
315 self._apps[GUI_TK] = app
316
317 from pydev_ipython.inputhooktk import create_inputhook_tk
318
319 self.set_inputhook(create_inputhook_tk(app))
320 return app
321
322 def disable_tk(self):
323 """Disable event loop integration with Tkinter.

Callers

nothing calls this directly

Calls 2

set_inputhookMethod · 0.95
create_inputhook_tkFunction · 0.90

Tested by

no test coverage detected