|
Packit |
1470ea |
|
|
Packit |
1470ea |
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" xmlns:e="http://projectmallard.org/experimental/" type="guide" style="task" id="properties.py" xml:lang="es">
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<info>
|
|
Packit |
1470ea |
<title type="text">Properties (Python)</title>
|
|
Packit |
1470ea |
<link type="guide" xref="beginner.py#theory"/>
|
|
Packit |
1470ea |
<link type="next" xref="grid.py"/>
|
|
Packit |
1470ea |
<revision version="0.1" date="2012-06-24" status="draft"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<desc>Una explicación de propiedades, funciones de obtención y asignación.</desc>
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Sebastian Pölsterl</name>
|
|
Packit |
1470ea |
<email its:translate="no">sebp@k-d-w.org</email>
|
|
Packit |
1470ea |
<years>2011</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
<credit type="editor">
|
|
Packit |
1470ea |
<name>Marta Maria Casetti</name>
|
|
Packit |
1470ea |
<email its:translate="no">mmcasetti@gmail.com</email>
|
|
Packit |
1470ea |
<years>2012</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Daniel Mustieles</mal:name>
|
|
Packit |
1470ea |
<mal:email>daniel.mustieles@gmail.com</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011 - 2017</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Nicolás Satragno</mal:name>
|
|
Packit |
1470ea |
<mal:email>nsatragno@gmail.com</mal:email>
|
|
Packit |
1470ea |
<mal:years>2012 - 2013</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
|
|
Packit |
1470ea |
<mal:name>Jorge González</mal:name>
|
|
Packit |
1470ea |
<mal:email>jorgegonz@svn.gnome.org</mal:email>
|
|
Packit |
1470ea |
<mal:years>2011</mal:years>
|
|
Packit |
1470ea |
</mal:credit>
|
|
Packit |
1470ea |
</info>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<title>Propiedades</title>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<links type="section"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<section id="overview">
|
|
Packit |
1470ea |
<title>Visión general</title>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
Las propiedades describen la configuración y el estado de los widgets, y cada widget tiene su conjunto particular de propiedades. Por ejemplo, un widget como un botón o una etiqueta tiene la propiedad label que contiene el texto del widget. Puede especificar el nombre y el valor de cualquier número de propiedades como argumentos de palabras clave cuando cree una instancia de un widget: por ejemplo, para crear una etiqueta alineada a la derecha con el texto «Hello World» y un ángulo de 25 grados, puede usar:
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
label = Gtk.Label(label="Hello World", angle=25, halign=Gtk.Align.END)
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
Alternativamente, puede definir estas propiedades por separado usando el método asociado a ellas.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
label = Gtk.Label()
|
|
Packit |
1470ea |
label.set_label("Hello World")
|
|
Packit |
1470ea |
label.set_angle(25)
|
|
Packit |
1470ea |
label.set_halign(Gtk.Align.END)
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
Una vez que haya creado esta etiqueta, puede obtener su texto con label.get_label() , y análogamente para las otras propiedades.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
En lugar de usar funciones de obtención y asignación, también puede obtener y establecer las propiedades con get_property("nombre-propiedad") y set_property("nombre-propiedad") , respectivamente.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
</section>
|
|
Packit |
1470ea |
<section id="references">
|
|
Packit |
1470ea |
<title>Referencias</title>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<link href="http://python-gtk-3-tutorial.readthedocs.org/en/latest/basics.html">Conceptos básicos sobre propiedades</link> en el tutorial de GTK+3 con Python
|
|
Packit |
1470ea |
</section>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
</page>
|