diff options
author | Guido van Rossum <guido@python.org> | 1994-07-06 09:26:20 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-07-06 09:26:20 (GMT) |
commit | e20864d6c2012485a8d1e7975f2f740d48cb2013 (patch) | |
tree | d97d33e1efd28c04fdde82e183019a00799a70c2 /Demo/tkinter/guido | |
parent | 2dcf529b55ea6302ebecfa8b4f02260183ef31e3 (diff) | |
download | cpython-e20864d6c2012485a8d1e7975f2f740d48cb2013.zip cpython-e20864d6c2012485a8d1e7975f2f740d48cb2013.tar.gz cpython-e20864d6c2012485a8d1e7975f2f740d48cb2013.tar.bz2 |
* kill.py: Don't use the exec Tcl command.
Diffstat (limited to 'Demo/tkinter/guido')
-rwxr-xr-x | Demo/tkinter/guido/kill.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Demo/tkinter/guido/kill.py b/Demo/tkinter/guido/kill.py index f7a70fa..93092e2 100755 --- a/Demo/tkinter/guido/kill.py +++ b/Demo/tkinter/guido/kill.py @@ -1,15 +1,16 @@ #!/usr/local/bin/tkpython -# Tkinter interface to Linux `ps' command. +# Tkinter interface to Linux `kill' command. from Tkinter import * from string import splitfields from string import split +import commands +import posix class BarButton(Menubutton): + _CNF = {Pack: {'side': 'left'}} def __init__(self, master=None, cnf={}): - Menubutton.__init__(self, master) - self.pack({'side': 'left'}) - self.config(cnf) + Menubutton.__init__(self, master, (self._CNF, cnf)) self.menu = Menu(self, {'name': 'menu'}) self['menu'] = self.menu @@ -26,11 +27,11 @@ class Kill(Frame): def kill(self, selected): c = self.format_list[self.format.get()][2] pid = split(selected)[c] - self.tk.call('exec', 'kill', '-9', pid) + posix.system('kill' + ' -9 ' + pid) self.do_update() def do_update(self): name, option, column = self.format_list[self.format.get()] - s = self.tk.call('exec', 'ps', '-w', option) + s = commands.getoutput('ps -w ' + option) list = splitfields(s, '\n') self.header.set(list[0]) del list[0] |