[gnome-devel-docs/beginners: 6/12] GTK+ Python Tutorial: page on properties



commit dcb72f1cc4ea3cea07d0341dcc70894466772ede
Author: Marta Maria Casetti <mmcasetti gmail com>
Date:   Tue Mar 5 09:06:51 2013 +0000

    GTK+ Python Tutorial: page on properties
    
    The page on properties, setters and getters has been revised.

 beginners-docs/C/properties.py.page |   65 ++++++++++++++++++++--------------
 1 files changed, 38 insertions(+), 27 deletions(-)
---
diff --git a/beginners-docs/C/properties.py.page b/beginners-docs/C/properties.py.page
index 412e351..985b878 100644
--- a/beginners-docs/C/properties.py.page
+++ b/beginners-docs/C/properties.py.page
@@ -4,46 +4,57 @@
       type="guide" style="task"
       id="properties.py">
 
-<info>
-  <title type="text">Properties (Python)</title>
-  <link type="guide" xref="beginner.py#theory"/>
-  <link type="next" xref="grid.py"/>
-  <revision version="0.1" date="2012-06-24" status="draft"/>
-
-  <desc>An explanation of properties, getters and setters.</desc>
-  <credit type="author copyright">
+  <info>
+    <title type="text">Properties (Python)</title>
+    <link type="next" xref="grid.py"/>
+    <revision version="0.2" date="2013-03-05" status="draft"/>
+
+    <desc>An explanation of properties, getters and setters.</desc>
+    <credit type="author copyright">
     <name>Sebastian P&#246;lsterl</name>
     <email>sebp k-d-w org</email>
     <years>2011</years>
-  </credit>
-  <credit type="editor">
+    </credit>
+    <credit type="author editor">
     <name>Marta Maria Casetti</name>
     <email>mmcasetti gmail com</email>
     <years>2012</years>
-  </credit>
-</info>
+    </credit>
+  </info>
 
-<title>Properties</title>
+  <title>Properties</title>
 
-<links type="section" />
+  <links type="section" />
 
-<section id="overview">
-<title>Overview</title>
+  <section id="overview">
+  <title>Overview</title>
 
-<p><em>Properties</em> describe the configuration and state of widgets, and each widget has its own 
particular set of properties. For example, a widget such as a button or a label has the property 
<code>label</code> which contains the text of the widget. You can specify the name and value of any number of 
properties as keyword arguments when creating an instance of a widget: for example, to create a label with 
the text “Hello World”, an angle of 25 degrees, and aligned to the right, you can use:</p>
-<code>
-label = Gtk.Label(label="Hello World", angle=25, halign=Gtk.Align.END)</code>
+  <p><em>Properties</em> describe the configuration and state of widgets. Each 
+  widget has its own particular set of properties. For example, a label has the 
+  property <code>label</code> which contains the text of the label. You can 
+  specify the name and value of any number of properties as keyword arguments 
+  when creating an instance of a widget: for example, to create a label with the 
+  text “Hello World”, an angle of 25 degrees, and aligned to the right, you can 
+  use:</p>
+  <code>
+  label = Gtk.Label(label="Hello World", angle=25, halign=Gtk.Align.END)</code>
 
-<p>which is equivalent to using:</p>
-<code>
-label = Gtk.Label()
-label.set_label("Hello World")
-label.set_angle(25)
-label.set_halign(Gtk.Align.END)</code>
+  <p>The same result can be obtained with specific methods (called 
+  <em>setters</em>), specified in the API of the widget:</p>
+  <code>
+  label = Gtk.Label()
+  label.set_label("Hello World")
+  label.set_angle(25)
+  label.set_halign(Gtk.Align.END)</code>
 
-<p>Once you have created such a label, you can get the text of the label with 
<code>label.get_label()</code>, and analogously for the other properties.</p>
+  <p>Once you have created your label, you can get its text with 
+  the <em>getter</em> <code>label.get_label()</code>, and analogously for the 
+  other properties.</p>
 
-<p>Instead of using getters and setters you can also get and set the properties with 
<code>get_property(<var>"prop-name"</var>)</code> and <code>set_property(<var>"prop-name"</var>, 
<var>value</var>)</code>, respectively.</p>
+  <p>Instead of using getters and setters you can also get and set the 
+  properties with <code>get_property(<var>"prop-name"</var>)</code> and 
+  <code>set_property(<var>"prop-name"</var>, <var>value</var>)</code>. The 
+  names of the properties for each widget can be found in the API.</p>
 
 </section>
 <section id="references">


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