Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: third_party/twisted_8_1/twisted/internet/tksupport.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4
5 """
6 This module integrates Tkinter with twisted.internet's mainloop.
7
8 Maintainer: U{Itamar Shtull-Trauring<mailto:twisted@itamarst.org>}
9
10 To use, do::
11
12 | tksupport.install(rootWidget)
13
14 and then run your reactor as usual - do *not* call Tk's mainloop(),
15 use Twisted's regular mechanism for running the event loop.
16
17 Likewise, to stop your program you will need to stop Twisted's
18 event loop. For example, if you want closing your root widget to
19 stop Twisted::
20
21 | root.protocol('WM_DELETE_WINDOW', reactor.stop)
22
23 """
24
25 # system imports
26 import Tkinter, tkSimpleDialog, tkMessageBox
27
28 # twisted imports
29 from twisted.python import log
30 from twisted.internet import task
31
32
33 _task = None
34
35 def install(widget, ms=10, reactor=None):
36 """Install a Tkinter.Tk() object into the reactor."""
37 installTkFunctions()
38 global _task
39 _task = task.LoopingCall(widget.update)
40 _task.start(ms / 1000.0, False)
41
42 def uninstall():
43 """Remove the root Tk widget from the reactor.
44
45 Call this before destroy()ing the root widget.
46 """
47 global _task
48 _task.stop()
49 _task = None
50
51
52 def installTkFunctions():
53 import twisted.python.util
54 twisted.python.util.getPassword = getPassword
55
56
57 def getPassword(prompt = '', confirm = 0):
58 while 1:
59 try1 = tkSimpleDialog.askstring('Password Dialog', prompt, show='*')
60 if not confirm:
61 return try1
62 try2 = tkSimpleDialog.askstring('Password Dialog', 'Confirm Password', s how='*')
63 if try1 == try2:
64 return try1
65 else:
66 tkMessageBox.showerror('Password Mismatch', 'Passwords did not match , starting over')
67
68 __all__ = ["install", "uninstall"]
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/internet/threads.py ('k') | third_party/twisted_8_1/twisted/internet/udp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698