0
自分のPC用のリモコンを作りたい。基本的に私が必要とするのは、ボタンクリックでコマンドを実行することです。これに続いてguide私はlayoutを構築することができました。それは私が今までに夢見てきたものです。 しかし、私は はこれを行うための簡単な方法があります。これは、gladeを使ったGUI over bash
(gtkdialog:18284): libglade-WARNING **: Expected <glade-interface>. Got <interface>.
(gtkdialog:18284): libglade-WARNING **: did not finish in PARSER_FINISH state
(gtkdialog:18284): libglade-CRITICAL **: glade_xml_get_widget: assertion 'self != NULL' failed
(gtkdialog:18284): ERROR **: Can not load 'MainWindow' from file 'test.glade'
そして、それは何が本当に起こりません後に発生
gtkdialog -g test.glade -p MainWindow
使用して、それを実行しようとすると?
私の考えは、別の仮想スクリーンにそのプログラムを置き、私の携帯電話を使ってそれにアクセスすることです。空き地ファイル
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="MainWindow">
<property name="can_focus">False</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="LvUP">
<property name="label" translatable="yes">Left Channel UP</property>
<property name="width_request">217</property>
<property name="height_request">154</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="amixer -c 1 set "PCM Front" 5%+,0%-" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="VolUp">
<property name="label" translatable="yes">Vol UP</property>
<property name="width_request">217</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="pactl set-sink-volume 0 +5%" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="RvUP">
<property name="label" translatable="yes">Right Channel UP</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="amixer -c 1 set "PCM Front" 0%-,5%+" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="prev">
<property name="label">gtk-media-previous</property>
<property name="height_request">154</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="play">
<property name="label" translatable="yes">Play/Pause</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="clementine -t" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="next">
<property name="label">gtk-media-next</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="clementine -f" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="LvDown">
<property name="label" translatable="yes">Left Channel Down</property>
<property name="height_request">154</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="amixer -c 1 set "PCM Front" 5%-,0%-" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="VolDown">
<property name="label" translatable="yes">Vol Down</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="pactl set-sink-volume 0 -5%" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="RvDown">
<property name="label" translatable="yes">Right Channel Down</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="amixer -c 1 set "PCM Front" 0%-,5%-" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="mute">
<property name="label" translatable="yes">Mute</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="foff">
<property name="label" translatable="yes">Hello Darkness, My Old Friend | foff</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="hib">
<property name="label" translatable="yes">Hib3rnate</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>
Gladeと 'GtkBuilder'に関するpython + GTK + 3チュートリアルのページです:https://python-gtk-3-tutorial.readthedocs.io/en/latest/builder.html – liberforce
ありがとうございました!それは完璧に働いた。 –