make it work with both python2 and python3

I ran 2to3, fixed up the output a tiny bit, and fixed the C module as
well.  I smoke tested with both versions of Python but didn't use it in
anger yet.

Fix #29
This commit is contained in:
Tom Tromey
2015-05-19 09:44:09 -06:00
parent 63baaf9c82
commit 22bdecb10d
8 changed files with 65 additions and 24 deletions

View File

@@ -70,15 +70,15 @@ class _ToplevelState(object):
def display(self):
with self.toplevel_lock:
if len(self.toplevels) == 0:
print "No windows"
print("No windows")
return
print ' Num Name'
print(' Num Name')
for winno in range(1, self.next_toplevel):
if winno in self.toplevels:
window = self.toplevels[winno]
print ' %3d %s' % (window.number,
window.window.get_title())
print(' %3d %s' % (window.number,
window.window.get_title()))
@in_gtk_thread
def _do_set_font(self, font_name):
@@ -123,7 +123,7 @@ class _ToplevelState(object):
@in_gtk_thread
def windows(self):
return self.toplevels.values()
return list(self.toplevels.values())
state = _ToplevelState()