我想获得一个没有背景的条目小部件(与主窗口的背景相同,如来自http://www.lanedo.com/~carlos/gtk3-doc/chap-drawing-model.html的第二张图片#figure-windowed-label)。对于标签小部件,情况就是这样,因为它们是无窗口小部件。我们可以从入口小部件做同样的事情吗?
请建议一种从以下代码中获取它的方法:
#! /usr/bin/perl
use Gtk2 -init;
my $dialog = Gtk2::Dialog->new ('Message', undef,
'destroy-with-parent',
'gtk-ok' => 'none');
my $label = Gtk2::Label->new ('Label text with no window: background of main window');
$dialog->get_content_area ()->add ($label);
my $entry = Gtk2::Entry->new();
$entry->set_text('Entry text, white background');
$dialog->get_content_area ()->add ($entry);
$dialog->show_all;
$dialog->signal_connect (response => sub { $_[0]->destroy });
$dialog->run;
谢谢!