1
1
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
2
2
# See LICENSE for details.
5
5
from wxPython.wx import *
7
from twisted.python import log
7
8
from twisted.internet import wxreactor
9
from twisted.internet import reactor
10
from twisted.internet import reactor, defer
12
13
# set up so that "hello, world" is printed once a second
15
reactor.callLater(1, helloWorld)
16
reactor.callLater(1, helloWorld)
17
print "hello, world (%s)" % (random.randint(0, 9),)
18
dc = reactor.callLater(0.1, helloWorld)
19
dc = reactor.callLater(0.1, helloWorld)
18
21
def twoSecondsPassed():
19
22
print "two seconds passed"
28
print "shutting down in 0.3 seconds"
31
reactor.callLater(0.1, printer, "2...")
32
reactor.callLater(0.2, printer, "1...")
33
reactor.callLater(0.3, printer, "0...")
35
reactor.callLater(0.3, d.callback, 1)
21
38
reactor.callLater(2, twoSecondsPassed)
39
reactor.addSystemEventTrigger("before", "shutdown", shutdown)
34
53
self.SetMenuBar(menuBar)
35
54
EVT_MENU(self, ID_EXIT, self.DoExit)
36
55
EVT_MENU(self, ID_DIALOG, self.DoDialog)
56
# you really ought to do this instead of reactor.stop() in
57
# DoExit, but for the sake of testing we'll let closing the
58
# window shutdown wx without reactor.stop(), to make sure that
59
# still does the right thing.
60
#EVT_CLOSE(self, lambda evt: reactor.stop())
38
62
def DoDialog(self, event):
39
63
dl = wxMessageDialog(self, "Check terminal to see if messages are still being "
40
64
"printed by Twisted.")
44
68
def DoExit(self, event):