Created
March 23, 2014 13:08
gtk3 builder example, julia + python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just as example, 2 setups - gui1 and fwindow2 - run by python gui3.py and julia example_gtk_build.jl, both setups have a GtkImage with a single draw1.svg | |
python gui3.py gui1.glade | |
python gui3.py fwindow2.glade | |
julia example_gtk_build.jl gui1.glade | |
julia example_gtk_build.jl fwindow2.glade | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Gtk | |
b = Gtk.GtkBuilder(ARGS[1]); | |
w = GAccessor.object(b,"window1"); | |
showall(w) | |
signal_connect(w,"destroy") do object, args... | |
exit() | |
end | |
wait(Condition()) | |
exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<interface> | |
<!-- interface-requires gtk+ 3.0 --> | |
<object class="GtkWindow" id="window1"> | |
<property name="can_focus">False</property> | |
<child> | |
<object class="GtkBox" id="box1"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="orientation">vertical</property> | |
<child> | |
<object class="GtkMenuBar" id="menubar1"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<child> | |
<object class="GtkMenuItem" id="menuitem1"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="label" translatable="yes">_File</property> | |
<property name="use_underline">True</property> | |
<child type="submenu"> | |
<object class="GtkMenu" id="menu1"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem1"> | |
<property name="label">gtk-new</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem2"> | |
<property name="label">gtk-open</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem3"> | |
<property name="label">gtk-save</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem4"> | |
<property name="label">gtk-save-as</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkSeparatorMenuItem" id="separatormenuitem1"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem5"> | |
<property name="label">gtk-quit</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
</object> | |
</child> | |
</object> | |
</child> | |
<child> | |
<object class="GtkMenuItem" id="menuitem2"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="label" translatable="yes">_Edit</property> | |
<property name="use_underline">True</property> | |
<child type="submenu"> | |
<object class="GtkMenu" id="menu2"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem6"> | |
<property name="label">gtk-cut</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem7"> | |
<property name="label">gtk-copy</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem8"> | |
<property name="label">gtk-paste</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem9"> | |
<property name="label">gtk-delete</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
</object> | |
</child> | |
</object> | |
</child> | |
<child> | |
<object class="GtkMenuItem" id="menuitem3"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="label" translatable="yes">_View</property> | |
<property name="use_underline">True</property> | |
</object> | |
</child> | |
<child> | |
<object class="GtkMenuItem" id="menuitem4"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="label" translatable="yes">_Help</property> | |
<property name="use_underline">True</property> | |
<child type="submenu"> | |
<object class="GtkMenu" id="menu3"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<child> | |
<object class="GtkImageMenuItem" id="imagemenuitem10"> | |
<property name="label">gtk-about</property> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="use_underline">True</property> | |
<property name="use_stock">True</property> | |
</object> | |
</child> | |
</object> | |
</child> | |
</object> | |
</child> | |
</object> | |
<packing> | |
<property name="expand">False</property> | |
<property name="fill">True</property> | |
<property name="padding">4</property> | |
<property name="position">0</property> | |
</packing> | |
</child> | |
<child> | |
<object class="GtkImage" id="image1"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="pixbuf">draw1.svg</property> | |
</object> | |
<packing> | |
<property name="expand">False</property> | |
<property name="fill">True</property> | |
<property name="position">1</property> | |
</packing> | |
</child> | |
</object> | |
</child> | |
</object> | |
</interface> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<interface> | |
<!-- interface-requires gtk+ 3.0 --> | |
<object class="GtkWindow" id="window1"> | |
<property name="can_focus">False</property> | |
<child> | |
<object class="GtkBox" id="box1"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="orientation">vertical</property> | |
<child> | |
<object class="GtkImage" id="image1"> | |
<property name="visible">True</property> | |
<property name="can_focus">False</property> | |
<property name="pixbuf">draw1.svg</property> | |
</object> | |
<packing> | |
<property name="expand">True</property> | |
<property name="fill">True</property> | |
<property name="position">0</property> | |
</packing> | |
</child> | |
<child> | |
<object class="GtkButton" id="button1"> | |
<property name="label" translatable="yes">button</property> | |
<property name="use_action_appearance">False</property> | |
<property name="visible">True</property> | |
<property name="can_focus">True</property> | |
<property name="receives_default">True</property> | |
<property name="use_action_appearance">False</property> | |
</object> | |
<packing> | |
<property name="expand">True</property> | |
<property name="fill">True</property> | |
<property name="position">1</property> | |
</packing> | |
</child> | |
<child> | |
<object class="GtkButton" id="button2"> | |
<property name="label" translatable="yes">button</property> | |
<property name="use_action_appearance">False</property> | |
<property name="visible">True</property> | |
<property name="can_focus">True</property> | |
<property name="receives_default">True</property> | |
<property name="use_action_appearance">False</property> | |
</object> | |
<packing> | |
<property name="expand">True</property> | |
<property name="fill">True</property> | |
<property name="position">2</property> | |
</packing> | |
</child> | |
</object> | |
</child> | |
</object> | |
</interface> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from gi.repository import Gtk | |
import sys | |
if __name__ == "__main__": | |
f = sys.argv[1] | |
builder = Gtk.Builder() | |
builder.add_from_file(f) | |
window = builder.get_object("window1") | |
window.connect('delete-event',Gtk.main_quit) | |
window.show() | |
Gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!!
Are there examples of GtkBuilder connect_signals for Julia?
Evgeny