# wxRuby setting the Frame's icon - getting started example

**URL:** <https://www.ruby-forum.com/t/wxruby-setting-the-frames-icon-getting-started-example/163723>\
**Category:** Ruby\
**Created:** [March 24, 2009, 12:08pm UTC](https://www.ruby-forum.com/t/wxruby-setting-the-frames-icon-getting-started-example/163723 "2009-03-24T12:08:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![7stud](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/7/57b2e6/32.png) [@7stud](https://www.ruby-forum.com/u/7stud)\
**Post date:** [March 24, 2009, 12:08pm UTC](https://www.ruby-forum.com/t/wxruby-setting-the-frames-icon-getting-started-example/163723/1 "2009-03-24T12:08:13Z")

</div>

The following is a simplified example from the wxRuby wiki here:

[http://wxruby.rubyforge.org/wiki/wiki.pl?Frames\_(Part\_1)](http://wxruby.rubyforge.org/wiki/wiki.pl?Frames_(Part_1))

It’s the second example in the wxRuby tutorial entitled “Getting  
Started”. However, I don’t seen any icon when I run the code on mac osx  
10.4.11.

require ‘rubygems’  
require ‘wx’

class IconFrame \< Wx::Frame

def initialize  
super(nil, -1, “Changing Icons”, Wx::DEFAULT\_POSITION,  
Wx::Size.new(300, 200)  
)

```
set_icon(Wx::Icon.new("./icons/DataHD.png"))

show

```

end

end

class MinimalApp \< Wx::App  
def on\_init  
IconFrame.new  
end  
end

MinimalApp.new.main\_loop

I also tried using some .ico files in set\_icon(), but I don’t see them  
anywhere.

---

<div class="post-metadata">

**Author:** ![7stud](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/7/57b2e6/32.png) [@7stud](https://www.ruby-forum.com/u/7stud)\
**Post date:** [March 24, 2009, 12:51pm UTC](https://www.ruby-forum.com/t/wxruby-setting-the-frames-icon-getting-started-example/163723/2 "2009-03-24T12:51:05Z")

</div>

7stud – wrote:

> The following is a simplified example from the wxRuby wiki here:
> 
> [http://wxruby.rubyforge.org/wiki/wiki.pl?Frames\_(Part\_1)](http://wxruby.rubyforge.org/wiki/wiki.pl?Frames_(Part_1))
> 
> It’s the second example in the wxRuby tutorial entitled “Getting  
> Started”. However, I don’t seen any icon when I run the code on mac osx  
> 10.4.11.

Frames in the OS X desktop don’t have icons - not in the same way as  
Windows has per-frame icons in the top-left corner.

If you want to set an application-wide icon to appear in the Dock, use  
Wx::TaskBarIcon. There’s an example of this in the bigdemo.rb sample  
that comes with wxRuby.

PS - wxRuby questions are better on the wxruby-users mailing list:

[http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists](http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists)  
[http://www.ruby-forum.com/forum/36](http://www.ruby-forum.com/forum/36)

a

---

<div class="post-metadata">

**Author:** ![7stud](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/7/57b2e6/32.png) [@7stud](https://www.ruby-forum.com/u/7stud)\
**Post date:** [March 24, 2009, 1:09pm UTC](https://www.ruby-forum.com/t/wxruby-setting-the-frames-icon-getting-started-example/163723/3 "2009-03-24T13:09:54Z")

</div>

Alex F. wrote:

> 7stud – wrote:
> 
> > The following is a simplified example from the wxRuby wiki here:
> > 
> > [http://wxruby.rubyforge.org/wiki/wiki.pl?Frames\_(Part\_1)](http://wxruby.rubyforge.org/wiki/wiki.pl?Frames_(Part_1))
> > 
> > It’s the second example in the wxRuby tutorial entitled “Getting  
> > Started”. However, I don’t seen any icon when I run the code on mac osx  
> > 10.4.11.
> 
> Frames in the OS X desktop don’t have icons - not in the same way as  
> Windows has per-frame icons in the top-left corner.
> 
> If you want to set an application-wide icon to appear in the Dock, use  
> Wx::TaskBarIcon. There’s an example of this in the bigdemo.rb sample  
> that comes with wxRuby.
> 
> PS - wxRuby questions are better on the wxruby-users mailing list:
> 
> [http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists](http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists)  
> [http://www.ruby-forum.com/forum/36](http://www.ruby-forum.com/forum/36)

Thanks for the response. Ok. Maybe the wiki should mention that?

By the way, did you see my results here:

[http://www.ruby-forum.com/topic/180219#new](http://www.ruby-forum.com/topic/180219#new)
