K2LL33D SHELL

 Apache/2.4.7 (Ubuntu)
 Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64
 uid=33(www-data) gid=33(www-data) groups=33(www-data)
 safemode : OFF
 MySQL: ON | Perl: ON | cURL: OFF | WGet: ON
  >  / usr / lib / python2.7 / dist-packages / twisted / internet /
server ip : 104.21.89.46

your ip : 172.69.214.217

H O M E


Filename/usr/lib/python2.7/dist-packages/twisted/internet/tksupport.py
Size1.92 kb
Permissionrw-r--r--
Ownerroot : root
Create time27-Apr-2025 09:56
Last modified06-Jun-2011 06:00
Last accessed27-Apr-2025 09:57
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.


"""
This module integrates Tkinter with twisted.internet's mainloop.

Maintainer: Itamar Shtull-Trauring

To use, do::

| tksupport.install(rootWidget)

and then run your reactor as usual - do *not* call Tk's mainloop(),
use Twisted's regular mechanism for running the event loop.

Likewise, to stop your program you will need to stop Twisted's
event loop. For example, if you want closing your root widget to
stop Twisted::

| root.protocol('WM_DELETE_WINDOW', reactor.stop)

When using Aqua Tcl/Tk on Mac OS X the standard Quit menu item in
your application might become unresponsive without the additional
fix::

| root.createcommand("::tk::mac::Quit", reactor.stop)

@see: U{Tcl/TkAqua FAQ for more info<http://wiki.tcl.tk/12987>}
"""

# system imports
import Tkinter, tkSimpleDialog, tkMessageBox

# twisted imports
from twisted.python import log
from twisted.internet import task


_task = None

def install(widget, ms=10, reactor=None):
"""Install a Tkinter.Tk() object into the reactor."""
installTkFunctions()
global _task
_task = task.LoopingCall(widget.update)
_task.start(ms / 1000.0, False)

def uninstall():
"""Remove the root Tk widget from the reactor.

Call this before destroy()ing the root widget.
"""
global _task
_task.stop()
_task = None


def installTkFunctions():
import twisted.python.util
twisted.python.util.getPassword = getPassword


def getPassword(prompt = '', confirm = 0):
while 1:
try1 = tkSimpleDialog.askstring('Password Dialog', prompt, show='*')
if not confirm:
return try1
try2 = tkSimpleDialog.askstring('Password Dialog', 'Confirm Password', show='*')
if try1 == try2:
return try1
else:
tkMessageBox.showerror('Password Mismatch', 'Passwords did not match, starting over')

__all__ = ["install", "uninstall"]