[gnome-devel-docs] platform-demos: Use enumerate in liststore example



commit d4befe0921daa6d285435393efde1ad6f7f094ed
Author: David King <amigadave amigadave com>
Date:   Thu Apr 6 10:46:12 2017 +0100

    platform-demos: Use enumerate in liststore example
    
    Thanks to Shiv Dhar for the suggestion.
    
    https://mail.gnome.org/archives/docs-feedback/2017-March/msg00008.html

 .../C/samples/treeview_simple_liststore.py         |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/platform-demos/C/samples/treeview_simple_liststore.py 
b/platform-demos/C/samples/treeview_simple_liststore.py
index bfd3298..902b334 100644
--- a/platform-demos/C/samples/treeview_simple_liststore.py
+++ b/platform-demos/C/samples/treeview_simple_liststore.py
@@ -31,7 +31,7 @@ class MyWindow(Gtk.ApplicationWindow):
         # a treeview to see the data stored in the model
         view = Gtk.TreeView(model=listmodel)
         # for each column
-        for i in range(len(columns)):
+        for i, column in enumerate(columns):
             # cellrenderer to render the text
             cell = Gtk.CellRendererText()
             # the text in the first column should be in boldface
@@ -39,7 +39,7 @@ class MyWindow(Gtk.ApplicationWindow):
                 cell.props.weight_set = True
                 cell.props.weight = Pango.Weight.BOLD
             # the column is created
-            col = Gtk.TreeViewColumn(columns[i], cell, text=i)
+            col = Gtk.TreeViewColumn(column, cell, text=i)
             # and it is appended to the treeview
             view.append_column(col)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]