# How to add icon to window

**URL:** <https://www.ruby-forum.com/t/how-to-add-icon-to-window/120645>\
**Category:** wxRuby\
**Created:** [November 19, 2007, 3:09pm UTC](https://www.ruby-forum.com/t/how-to-add-icon-to-window/120645 "2007-11-19T15:09:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [November 19, 2007, 3:09pm UTC](https://www.ruby-forum.com/t/how-to-add-icon-to-window/120645/1 "2007-11-19T15:09:16Z")

</div>

I have icon file and I want to add it to top-left of my application  
How can I add it ??

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [November 19, 2007, 3:16pm UTC](https://www.ruby-forum.com/t/how-to-add-icon-to-window/120645/2 "2007-11-19T15:16:24Z")

</div>

Pat K. wrote:

> I have icon file and I want to add it to top-left of my application  
> How can I add it ??

Use Frame#icon= or Frame#set\_icon method.

PNG icons are usually the best cross-platform option:

my\_frame.icon = Wx::Icon.new(‘path/to/icon.png’, Wx::BITMAP\_TYPE\_PNG)

You can also use .ico icons on Windows only, and .xpm on Linux:

my\_frame.icon = Wx::Icon.new(’/path/to/icon.ico’)

You might want to take a look at the samples directory that comes with  
wxRuby. Most basic operations such as this, as well as many advanced  
usages are demonstrated in those samples.

alex

---

<div class="post-metadata">

**Author:** ![blitzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecae2f/32.png) [@blitzer](https://www.ruby-forum.com/u/blitzer)\
**Post date:** [November 19, 2007, 4:40pm UTC](https://www.ruby-forum.com/t/how-to-add-icon-to-window/120645/3 "2007-11-19T16:40:22Z")

</div>

thank you 🙂
