[Python-checkins] r83618 - in python/branches/py3k/Demo/tkinter/guido: AttrDialog.py ManPage.py brownian2.py kill.py

georg.brandl python-checkins at python.org
Tue Aug 3 01:30:09 CEST 2010


Author: georg.brandl
Date: Tue Aug  3 01:30:09 2010
New Revision: 83618

Log:
Fix-up some tkinter demos.

Modified:
   python/branches/py3k/Demo/tkinter/guido/AttrDialog.py
   python/branches/py3k/Demo/tkinter/guido/ManPage.py
   python/branches/py3k/Demo/tkinter/guido/brownian2.py
   python/branches/py3k/Demo/tkinter/guido/kill.py

Modified: python/branches/py3k/Demo/tkinter/guido/AttrDialog.py
==============================================================================
--- python/branches/py3k/Demo/tkinter/guido/AttrDialog.py	(original)
+++ python/branches/py3k/Demo/tkinter/guido/AttrDialog.py	Tue Aug  3 01:30:09 2010
@@ -120,7 +120,7 @@
                 cl = self.classes[c]
             except KeyError:
                 cl = 'unknown'
-            if type(cl) == TupleType:
+            if type(cl) == tuple:
                 cl = self.enumoption
             elif cl == 'boolean':
                 cl = self.booleanoption

Modified: python/branches/py3k/Demo/tkinter/guido/ManPage.py
==============================================================================
--- python/branches/py3k/Demo/tkinter/guido/ManPage.py	(original)
+++ python/branches/py3k/Demo/tkinter/guido/ManPage.py	Tue Aug  3 01:30:09 2010
@@ -107,13 +107,13 @@
             # Save this line -- we need one line read-ahead
             self.buffer = nextline
             return
-        if emptyprog.match(self.buffer) >= 0:
+        if emptyprog.match(self.buffer):
             # Buffered line was empty -- set a flag
             self.empty = 1
             self.buffer = nextline
             return
         textline = self.buffer
-        if ulprog.match(nextline) >= 0:
+        if ulprog.match(nextline):
             # Next line is properties for buffered line
             propline = nextline
             self.buffer = None
@@ -127,7 +127,7 @@
             self.ok = 1
             self.empty = 0
             return
-        if footerprog.match(textline) >= 0:
+        if footerprog.match(textline):
             # Footer -- start skipping until next non-blank line
             self.ok = 0
             self.empty = 0
@@ -190,7 +190,7 @@
     import os
     import sys
     # XXX This directory may be different on your system
-    MANDIR = '/usr/local/man/mann'
+    MANDIR = ''
     DEFAULTPAGE = 'Tcl'
     formatted = 0
     if sys.argv[1:] and sys.argv[1] == '-f':

Modified: python/branches/py3k/Demo/tkinter/guido/brownian2.py
==============================================================================
--- python/branches/py3k/Demo/tkinter/guido/brownian2.py	(original)
+++ python/branches/py3k/Demo/tkinter/guido/brownian2.py	Tue Aug  3 01:30:09 2010
@@ -32,7 +32,7 @@
             yield None
 
 def move(particle): # move the particle at random time
-    particle.next()
+    next(particle)
     dt = random.expovariate(LAMBDA)
     root.after(int(dt*1000), move, particle)
 

Modified: python/branches/py3k/Demo/tkinter/guido/kill.py
==============================================================================
--- python/branches/py3k/Demo/tkinter/guido/kill.py	(original)
+++ python/branches/py3k/Demo/tkinter/guido/kill.py	Tue Aug  3 01:30:09 2010
@@ -2,8 +2,6 @@
 # Tkinter interface to Linux `kill' command.
 
 from tkinter import *
-from string import splitfields
-from string import split
 import subprocess
 import os
 
@@ -26,13 +24,13 @@
                    ('Hex', '-X', 0)]
     def kill(self, selected):
         c = self.format_list[self.format.get()][2]
-        pid = split(selected)[c]
+        pid = selected.split()[c]
         os.system('kill -9 ' + pid)
         self.do_update()
     def do_update(self):
         name, option, column = self.format_list[self.format.get()]
         s = subprocess.getoutput('ps -w ' + option)
-        list = splitfields(s, '\n')
+        list = s.split('\n')
         self.header.set(list[0])
         del list[0]
         y = self.frame.vscroll.get()[0]


More information about the Python-checkins mailing list