<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" style="task" id="tour-gjs" xml:lang="es">
<info>
<link type="next" xref="tour-events"/>
<revision version="0.1" date="2013-06-17" status="stub"/>
<credit type="author copyright">
<name>Ekaterina Gerasimova</name>
<email its:translate="no">kittykat3756@gmail.com</email>
<years>2013</years>
</credit>
<credit type="author copyright">
<name>Gordon Hill</name>
<email its:translate="no">caseyweederman@gmail.com</email>
<years>2013</years>
</credit>
<include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>
<desc>Incluya las vinculaciones necesarias para ejecutar su script.</desc>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Daniel Mustieles</mal:name>
<mal:email>daniel.mustieles@gmail.com</mal:email>
<mal:years>2011-2017</mal:years>
</mal:credit>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Jorge González</mal:name>
<mal:email>jorgegonz@svn.gnome.org</mal:email>
<mal:years>2007-2010</mal:years>
</mal:credit>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Mario Carrión</mal:name>
<mal:email>mario@monouml.org</mal:email>
<mal:years>2006</mal:years>
</mal:credit>
</info>
<title>Gjs y GTK+</title>
<links type="prevnext" style="top"/>
<links type="series" style="floatend">
<title>Primeros pasos en GNOME</title>
</links>
<p><link href="https://wiki.gnome.org/Projects/Gjs">Gjs</link> es una vinculación de JavaScript para GNOME y se puede usar para interactuar con GTK. <link href="http://www.gtk.org/">GTK+</link> es un kit de herramientas para crear interfaces gráficas de usuario.</p> <p>Abra un editor de texto y pegue las líneas de código. El script completo está disponible en el <link xref="tour-summary">Resumen</link>.</p> <p>Cree un <code>objeto</code> usando su <code>clase</code> y llame al método <code>run()</code>:</p> <example>
<p>Llame a la vinculación de JavaScript Gjs. Esto hará que la shell ejecute este scrip con Gjs.</p>
<code>
#!/usr/bin/gjs
</code>
<p>Importe <code>gi.Gtk</code> para las funciones de <code>Gtk</code>. Como puede tener instaladas tanto la versión 3.0 como la 4.0, asegúrese de que importa primero la versión que necesita.</p>
<code>
imports.gi.versions.Gtk = '3.0';
const Gtk = imports.gi.Gtk;
</code>
</example>
<links type="prevnext"/>
</page>