# How can my instantiated "worker" class talk to the UI?

**URL:** <https://www.ruby-forum.com/t/how-can-my-instantiated-worker-class-talk-to-the-ui/183201>\
**Category:** Ruby-Gnome 2\
**Created:** [February 9, 2010, 10:52pm UTC](https://www.ruby-forum.com/t/how-can-my-instantiated-worker-class-talk-to-the-ui/183201 "2010-02-09T22:52:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjglazer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@sjglazer](https://www.ruby-forum.com/u/sjglazer)\
**Post date:** [February 9, 2010, 10:52pm UTC](https://www.ruby-forum.com/t/how-can-my-instantiated-worker-class-talk-to-the-ui/183201/1 "2010-02-09T22:52:20Z")

</div>

So I have a simple app that is a console IRC client. It uses sockets to  
connect to the specified server, interprets commands entered by the user  
(via STDIN), and writes data received from the socket to STDOUT.  
Simple.

Now I want to use this class (after whatever mods are needed) with a  
ruby-gtk GUI. I’ve used Glade3 to layout the basic UI and used  
ruby-glade-create-template to generate some initial code. I am able to  
use  
the on\_connect\_clicked method to create a new IRC object which  
succesfully  
connects and I can see the output to the console… but now what? I’m  
at a  
loss for how one goes about having the output go to a Gtk TextBuffer  
rather  
than “putsing” it to STDOUT. I think I could use globals and get it to  
work, but I’m not sure… and I think that may be a bad idea.

Any advice or pointers would be appreciated.

Thanks,  
-Steve
