# Transparent widgets?

**URL:** <https://www.ruby-forum.com/t/transparent-widgets/171350>\
**Category:** wxRuby\
**Created:** [June 30, 2009, 11:27pm UTC](https://www.ruby-forum.com/t/transparent-widgets/171350 "2009-06-30T23:27:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![quintus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/49beb7/32.png) [@quintus](https://www.ruby-forum.com/u/quintus)\
**Post date:** [June 30, 2009, 11:27pm UTC](https://www.ruby-forum.com/t/transparent-widgets/171350/1 "2009-06-30T23:27:04Z")

</div>

Hi,

I’m trying to create a transparent window with a StaticText on it, but I  
didn’t found out how this is possible. My Code looks like this:  
`
#Encoding: UTF-8
require “wx”
require “wx_sugar”
include Wx
class TransparentFrame < Frame`

def initialize  
super(nil, -1, “Test”, DEFAULT\_POSITION, Size.new(400, 400),  
DEFAULT\_FRAME\_STYLE | TRANSPARENT\_WINDOW) #defining transparency style  
set\_background\_colour(Colour.new(0, 0, 0, 0)) #Setting transparent  
back  
end

#Overriding has\_transparent\_background  
def has\_transparent\_background  
true  
end  
end

class Sample \< App

def on\_init  
@mainwindow = TransparentFrame.new #Creating transparent Frame  
@text = StaticText.new(@mainwindow, -1, “Test”)  
@text.set\_foreground\_colour(Colour.from\_hex("#FFFFFF"))  
@text.set\_font(Font.new(60, FONTFAMILY\_ROMAN, FONTSTYLE\_NORMAL,  
FONTWEIGHT\_BOLD))  
@text.centre\_on\_parent

```
@mainwindow.show

```

end

end

x = Sample.new  
x.main\_loop  
  
That only displays a white text on a black background - no transparency.  
I’m working with  
Windows Vista Home Premium  
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mingw32]

Marvin

---

<div class="post-metadata">

**Author:** ![quintus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/49beb7/32.png) [@quintus](https://www.ruby-forum.com/u/quintus)\
**Post date:** [July 1, 2009, 1:15am UTC](https://www.ruby-forum.com/t/transparent-widgets/171350/2 "2009-07-01T01:15:25Z")

</div>

Marvin,

Have you taken a look at the demos that come with wxRuby, specifically  
at  
bigdemo. There should be a way to show you can do a Transparent frame  
by  
looking at the demo with the big graphic of a Ruby, believe that it’s an  
example of how to do a Splash Screen.
