# (debian,eclipse) GUI created with glade does not appear

**URL:** <https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411>\
**Category:** Ruby-Gnome 2\
**Created:** [April 24, 2009, 10:24pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411 "2009-04-24T22:24:29Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 24, 2009, 10:24pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/1 "2009-04-24T22:24:29Z")

</div>

hi,

some informations:

- I have debian lenny, with gnome
- I have eclipse + the plugin DLTK (for ruby)
- I have installed the packages ruby1.8, ruby1.8-dev, ruby-gnome2,  
libglade-2, glade-gnome and glade-3.

I thought I have all installed but when I follow this tutorial : (in  
french) :  
[http://www.rubyfr.org/documentations/ruby-ihm/ruby-gnome/gnome2-glade/](http://www.rubyfr.org/documentations/ruby-ihm/ruby-gnome/gnome2-glade/) ,  
I launch the project under eclipse (“run script”) and … nothing  
happens : no error message, no message at the console.  
if I add “puts ‘hello’” at the end of the script … it doesn’t appear  
at the console window…

maybe there is a problem with libglade2 and gtk2, but what is it?

the gem tool tells me there is no gem installed (maybe libglade2 and  
gtk2 aren’t recognized, but how to be sure?).

olivier.

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 1:04am UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/2 "2009-04-25T01:04:39Z")

</div>

Did you set the window ‘visible’ in glade? Or you can call ‘show’ or  
‘show\_all’ on the window.

There are also many existing ruby/glade applications that you could  
examine, such as:  
[https://launchpad.net/screenruler](https://launchpad.net/screenruler)

On Fri, Apr 24, 2009 at 1:24 PM, Olivier Saint-eve

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 8:06am UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/3 "2009-04-25T08:06:09Z")

</div>

hello,

thx for your answer.  
I tried your program, and it works well.

can you tell me how to call the method show\_all in the program  
following:

* * *

#!/usr/bin/env ruby

# 

# This file is gererated by ruby-glade-create-template 1.1.4.

# 

require ‘libglade2’  
require ‘gtk2’

class Fenetre2Glade  
include GetText

attr :glade

def initialize(path\_or\_data, root = nil, domain = nil, localedir =  
nil, flag = GladeXML::FILE)  
bindtextdomain(domain, localedir, nil, “UTF-8”)  
@glade = GladeXML.new(path\_or\_data, root, domain, localedir, flag)  
{|handler| method(handler)}

end

def on\_button1\_clicked(widget)  
puts “on\_button1\_clicked() is not implemented yet.”  
end  
end

# Main program

if **FILE** == $0

# Set values as your own application.

Gtk.init  
PROG\_PATH = “fenetre\_2.glade”  
PROG\_NAME = “YOUR\_APPLICATION\_NAME”  
a=Fenetre2Glade.new(PROG\_PATH, nil, PROG\_NAME)  
Gtk.main  
puts “fini”  
end

* * *

lolveley.

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 8:10am UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/4 "2009-04-25T08:10:13Z")

</div>

I tried to enter a.show\_all() but I think it’s wrong.

olivier.

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 12:09pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/5 "2009-04-25T12:09:45Z")

</div>

Hi,

am Sat, 25 Apr 2009 08:06:09 +0200, tat Olivier Saint-eve  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) der Welt kund:

> # 
> 
> def initialize(path\_or\_data, root = nil, domain = nil, localedir =  
> nil, flag = GladeXML::FILE)  
> bindtextdomain(domain, localedir, nil, “UTF-8”)  
> @glade = GladeXML.new(path\_or\_data, root, domain, localedir, flag)  
> {|handler| method(handler)}

@glade[‘name\_of\_your\_window’].show\_all

> Gtk.init  
> PROG\_PATH = “fenetre\_2.glade”  
> PROG\_NAME = “YOUR\_APPLICATION\_NAME”  
> a=Fenetre2Glade.new(PROG\_PATH, nil, PROG\_NAME)  
> Gtk.main  
> puts “fini”  
> end
> 
> * * *
> 
> lolveley.

Cheers, detlef

–  
[http://det.cable.nu](http://det.cable.nu)

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 12:39pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/6 "2009-04-25T12:39:30Z")

</div>

hello,

I tried this program:

* * *

#!/usr/bin/env ruby

# 

require ‘libglade2’  
require ‘gtk2’  
class MonAppli  
def initialize(file, root)  
@main\_glade\_xml = GladeXML.new(file, root) {|handler|  
method(handler)}  
@main\_glade\_xml[‘fenetre\_2’].show\_all  
end  
def on\_button1\_clicked  
puts “clicked !”  
end  
end

Gtk.init  
a=MonAppli.new("/home/lolveley/eclipse/plan\_de\_travail/test\_1/fenetre\_2.glade",nil)

Gtk.main

puts “hello”

* * *

but I obtain two errors:

- first, the line with “show\_all” is rejected : the compiler says that  
the nil object doesn’t have the method “show\_all” (the error seems hence  
to be at the line above, the GladeXML.new)
- secondly : after “a=MonAppli.new…”, I tried “a.glade” but it is not  
recognized.in theory, is it well? why can’t I obtain this field?

olivier.

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 12:56pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/7 "2009-04-25T12:56:24Z")

</div>

I succeeded in displying the window!  
I changed the path to the file fenetre\_2.glade, with the path of the  
copy of the file but in an other directory, and it went well.

nevertheless, do you know the answer at the two questions in my previous  
post?

it still doesn’t run.

olivier.

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 2:37pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/8 "2009-04-25T14:37:43Z")

</div>

I add that the initial “.glade” file was corrupted, so when I made  
another “.glade” file all worked good.

olivier.

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 1:06pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/9 "2009-04-25T13:06:02Z")

</div>

am Sat, 25 Apr 2009 12:39:30 +0200, tat Olivier Saint-eve  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) der Welt kund:

Hi,

> but I obtain two errors:
> 
> - first, the line with “show\_all” is rejected : the compiler says that  
> the nil object doesn’t have the method “show\_all” (the error seems hence  
> to be at the line above, the GladeXML.new)

I tried your example and it works for me.

If Glade doesn’t find the glade file you will get a error message like

libglade-WARNING \*\*:could not find glade file

But you get an error message, that show\_all doesn’t exist for nil. That  
means that your glade file is successfully loaded. But in you glade  
file is no object called fenetre\_2.

With @main\_glade\_xml[‘some\_widget’] you ask for a widget, that is  
called some\_widget in your glade file. So your main window has to be  
named fenetre\_2.

Btw. it would be useful, if you also post the error output of the  
console for the example code.

Cheers, detlef

–  
[http://det.cable.nu](http://det.cable.nu)

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 10:44pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/10 "2009-04-25T22:44:16Z")

</div>

It might look something like this:

main\_window = a.get\_widget(‘main\_window’)  
main\_window.show # see also: main\_window.present

best,  
-Ian

On Fri, Apr 24, 2009 at 11:06 PM, Olivier Saint-eve

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 2:36pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/11 "2009-04-25T14:36:07Z")

</div>

thanks detlef, there is no need to post another message, all works fine!

olivier.

---

<div class="post-metadata">

**Author:** ![rvork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f6c823/32.png) [@rvork](https://www.ruby-forum.com/u/rvork)\
**Post date:** [April 25, 2009, 10:46pm UTC](https://www.ruby-forum.com/t/debian-eclipse-gui-created-with-glade-does-not-appear/166411/12 "2009-04-25T22:46:37Z")

</div>

Oops, too late. Glad you got it working.
