|
Packit |
1470ea |
|
|
Packit |
1470ea |
<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="fr">
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<info>
|
|
Packit |
1470ea |
<link type="next" xref="tour-events"/>
|
|
Packit |
1470ea |
<revision version="0.1" date="2013-06-17" status="stub"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Ekaterina Gerasimova</name>
|
|
Packit |
1470ea |
<email its:translate="no">kittykat3756@gmail.com</email>
|
|
Packit |
1470ea |
<years>2013</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Gordon Hill</name>
|
|
Packit |
1470ea |
<email its:translate="no">caseyweederman@gmail.com</email>
|
|
Packit |
1470ea |
<years>2013</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<desc>Include bindings necessary to run your script.</desc>
|
|
Packit |
1470ea |
</info>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<title>Gjs and Gtk</title>
|
|
Packit |
1470ea |
<links type="prevnext" style="top"/>
|
|
Packit |
1470ea |
<links type="series" style="floatend">
|
|
Packit |
1470ea |
<title>Get started with GNOME</title>
|
|
Packit |
1470ea |
</links>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<link href="https://wiki.gnome.org/Projects/Gjs">Gjs</link> is a
|
|
Packit |
1470ea |
JavaScript binding for GNOME and can be used to interact with Gtk. <link href="http://www.gtk.org/">Gtk</link> is a toolkit for creating graphical user
|
|
Packit |
1470ea |
interfaces. Open a text editor and paste in the lines of code. The
|
|
Packit |
1470ea |
complete script is available in the <link xref="tour-summary">Summary</link>. Create an object using
|
|
Packit |
1470ea |
your class and call the run() method: <example>
|
|
Packit |
1470ea |
Call the Gjs JavaScript binding. This instructs the shell to run this script
|
|
Packit |
1470ea |
with Gjs.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
#!/usr/bin/gjs
|
|
Packit |
1470ea |
]]>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
Import gi.Gtk for Gtk functions. As both
|
|
Packit |
1470ea |
version 3.0 and 4.0 may be installed, make sure that the desired version
|
|
Packit |
1470ea |
is imported first.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
imports.gi.versions.Gtk = '3.0';
|
|
Packit |
1470ea |
const Gtk = imports.gi.Gtk;
|
|
Packit |
1470ea |
]]>
|
|
Packit |
1470ea |
</example>
|
|
Packit |
1470ea |
<links type="prevnext"/>
|
|
Packit |
1470ea |
</page>
|