On Aug 21, 2006, at 9:18 PM, Dave Mihalik wrote:
> Does anyone know if it is even possible to change the window icon  
> using
> Ruby and Tk?

I'm replying only because nobody else seems willing to and not  
because I have the answer you're seeking. The short answer seems to  
be: no, but it might be platform dependent. The semi-official RubyTk  
documentation <http://www.jbrowse.com/text/rubytk_en.html> that I  
consulted gives the following example:

<example>
Tk::Wm#iconbitmap(bitmap=None)
Sets the bitmap displayed in the icon to bitmap.

If nil is passed, the icon's bitmap setting is erased. If the  
argument is omitted, the current setting is returned.

require "tk"
Tk.root.iconify
p Tk.root.iconbitmap "question"
p Tk.root.iconbitmap
Tk.mainloop

=> ""
    "question"
</example>

Perhaps this code can change the window icon on platforms running X- 
Window/Motif, but I can't say from experience.

Running it on my platform, OS X with Aqua, produces no visible  
effect. But how could it? From OS X's point of view the Ruby program  
is a Unix command line session, and it displays the appropriate icon  
for such a session in the dock. If I minimize a Tk window, I get a  
bitmap thumbnail of the running window in the dock (again normal for  
OS X).

On OS X, I could get a custom icon by making the Ruby program a  
component of an application package (bundle) containing an icon  
resource, an info.plist file, and a launcher script written in  
AppleScript. On MS Windows, it's probably all very different. I  
wouldn't have a clue on how get a custom program icon there.

Regards, Morton