hi, I have problem when I want to set window background
I use this
@window = Window.new
@window.set_icon($icon)
@window.resizable=false
@window.set_title("XXX")
and if I want to set background color I will use
@window.modify_bg(STATE_NORMAL,Gdk::Color.new(254*254, 253*253,
236*236))
It work in color but I want image for background how can I do it??
on 18.05.2008 19:12
on 19.05.2008 09:52
On Sun, May 18, 2008 at 7:12 PM, Pat Kiatchaipipat <ruby-forum-incoming@andreas-s.net> wrote: > @window.modify_bg(STATE_NORMAL,Gdk::Color.new(254*254, 253*253, > 236*236)) > > It work in color but I want image for background how can I do it?? You might try an approach similar to: http://www.perlmonks.org/?node_id=530173 -- Guillaume Cottenceau - http://zarb.org/~gc/
on 20.05.2008 09:57
sub set_bg{
my $values;
my ($widget, $context, @other_params) = @_;
my $colormap = $window->get_default_colormap;
my $pixbuff = Gtk2::Gdk::Pixbuf->new_from_file("figure.png");
my $graphicContext = Gtk2::GC->get(Gtk2::Gdk::Visual->get_best_depth,
$colormap,
$values);
$pixbuff->render_to_drawable($widget->get_parent_window,
$graphicContext,
0,0,0,0,500,500,'normal',0,0);
}
what is "my ($widget, $context, @other_params) = @_"?????
I don't understand all above- -"
can you convert set_bg fuction to ruby language for me please :'(
on 11.09.2008 16:44
Define a function (def) > sub set_bg{ > initialize values (variables) > my $values; convert parameters to vars usage is set_bg($widget,$context,@other_params) in perl > my ($widget, $context, @other_params) = @_; with 'my' you initialize a variable (in object window are using a method get_default_colormap > my $colormap = $window->get_default_colormap; > my $pixbuff = Gtk2::Gdk::Pixbuf->new_from_file("figure.png"); > my $graphicContext = Gtk2::GC->get(Gtk2::Gdk::Visual->get_best_depth, > $colormap, > $values); > $pixbuff->render_to_drawable($widget->get_parent_window, > $graphicContext, > 0,0,0,0,500,500,'normal',0,0); > } > > what is "my ($widget, $context, @other_params) = @_"????? > I don't understand all above- -" > can you convert set_bg fuction to ruby language for me please :'( Greets from Argentina! By ToCaDo157
on 12.09.2008 21:02
> with 'my' you initialize a variable
I hate perl syntax. ;)
Ruby is a lot cleaner.