R
robertospara
I don't mean Label object but font in Entry or TextView object?
Please for help and thanks from the mountains
Please for help and thanks from the mountains
I don't mean Label object but font in Entry or TextView object?
Please for help and thanks from the mountains
I don't mean Label object but font in Entry or TextView object?
Please for help and thanks from the mountains
For Entry:
#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 '-init';
#the Entry settings in ~/.gtkrc-2.0 dosn't
#seem to do anything except create a subtle outline
#under the entry box. So you need to manually make one.
Gtk2::Rc->parse_string(<<__);
include "/usr/local/share/themes/Bumblebee/gtk-2.0/gtkrc"
style "normal" {
font_name ="serif 30"
}
style "my_entry" {
font_name ="sans 25"
text[NORMAL] = "#FF0000"
}
widget "*" style "normal"
widget "*Entry*" style "my_entry"
__
my $window = Gtk2::Window->new;
$window->set_title("Hello world");
$window->signal_connect( destroy => sub { Gtk2->main_quit; } );
my $vbox = Gtk2::VBox->new();
$vbox->set( "border_width" => 10 );
$window->add($vbox);
my $label = Gtk2::Label->new("??????");
$vbox->pack_start( $label, 0, 0, 5 ); # expand?, fill?, padding
my $entry = Gtk2::Entry->new();
$vbox->pack_start( $entry, 0, 0, 5 );
my $button = Gtk2::Widget->new( "Gtk2::Button", label => "Quit" );
$button->signal_connect( clicked => sub { Gtk2->main_quit; } );
$vbox->pack_start( $button, 0, 0, 5 );
$window->show_all();
Gtk2->main;
__END__
#####################################################3
####################################################
for the textview, the only glitch to watch for is cursor color
#!/usr/bin/perl
use warnings;
use strict;
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';
Gtk2::Rc->parse_string(<<__);
style "my_text" {
font_name ="sans 24"
text[NORMAL] = "#FFAA00"
base[NORMAL] = "#000000"
GtkTextView::cursor-color = "red"
}
style "my_cursor"{
fg[NORMAL] = "#FF0000"
}
widget "*Text*" style "my_text"
__
my $window = Gtk2::Window->new('toplevel');
$window->set_title('Z');
$window ->signal_connect( 'destroy' => \&delete_event );
$window->set_border_width(10);
$window->set_size_request(400,400);
my $vbox = Gtk2::VBox->new( FALSE, 6 );
$window->add($vbox);
$vbox->set_border_width(2);
my $hbox= Gtk2::HBox->new( FALSE, 6 );
$vbox->pack_end($hbox,FALSE,FALSE,0);
my $ebutton = Gtk2::Button->new_from_stock('gtk-quit');
$hbox->pack_end( $ebutton, FALSE, FALSE, 0 );
$ebutton->signal_connect( clicked => \&delete_event );
# Create a textbuffer to contain that string
my $textbuffer = Gtk2::TextBuffer->new();
$textbuffer->set_text('yadda yadda yadda');
# Create a textview using that textbuffer
my $textview = Gtk2::TextView->new_with_buffer($textbuffer);
# Add the textview to a scrolledwindow
my $scrolledwindow = Gtk2::ScrolledWindow->new( undef, undef );
$scrolledwindow->add($textview);
$vbox->pack_start($scrolledwindow, 1, 1, 0 );
$window->show_all();
Gtk2->main;
#####################################
sub delete_event {
Gtk2->main_quit;
return FALSE;
}
#######################################
__END__
I don't mean Label object but font in Entry or TextView object?
Please for help and thanks from the mountains
For Entry:
#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 '-init';
#the Entry settings in ~/.gtkrc-2.0 dosn't
#seem to do anything except create a subtle outline
#under the entry box. So you need to manually make one.
Gtk2::Rc->parse_string(<<__);
include "/usr/local/share/themes/Bumblebee/gtk-2.0/gtkrc"
style "normal" {
font_name ="serif 30"
}
style "my_entry" {
font_name ="sans 25"
text[NORMAL] = "#FF0000"
}
widget "*" style "normal"
widget "*Entry*" style "my_entry"
__
my $window = Gtk2::Window->new;
$window->set_title("Hello world");
$window->signal_connect( destroy => sub { Gtk2->main_quit; } );
my $vbox = Gtk2::VBox->new();
$vbox->set( "border_width" => 10 );
$window->add($vbox);
my $label = Gtk2::Label->new("??????");
$vbox->pack_start( $label, 0, 0, 5 ); # expand?, fill?, padding
my $entry = Gtk2::Entry->new();
$vbox->pack_start( $entry, 0, 0, 5 );
my $button = Gtk2::Widget->new( "Gtk2::Button", label => "Quit" );
$button->signal_connect( clicked => sub { Gtk2->main_quit; } );
$vbox->pack_start( $button, 0, 0, 5 );
$window->show_all();
Gtk2->main;
__END__
#####################################################3
####################################################
for the textview, the only glitch to watch for is cursor color
#!/usr/bin/perl
use warnings;
use strict;
use Glib qw/TRUE FALSE/;
use Gtk2 '-init';
Gtk2::Rc->parse_string(<<__);
style "my_text" {
font_name ="sans 24"
text[NORMAL] = "#FFAA00"
base[NORMAL] = "#000000"
GtkTextView::cursor-color = "red"
}
style "my_cursor"{
fg[NORMAL] = "#FF0000"
}
widget "*Text*" style "my_text"
__
my $window = Gtk2::Window->new('toplevel');
$window->set_title('Z');
$window ->signal_connect( 'destroy' => \&delete_event );
$window->set_border_width(10);
$window->set_size_request(400,400);
my $vbox = Gtk2::VBox->new( FALSE, 6 );
$window->add($vbox);
$vbox->set_border_width(2);
my $hbox= Gtk2::HBox->new( FALSE, 6 );
$vbox->pack_end($hbox,FALSE,FALSE,0);
my $ebutton = Gtk2::Button->new_from_stock('gtk-quit');
$hbox->pack_end( $ebutton, FALSE, FALSE, 0 );
$ebutton->signal_connect( clicked => \&delete_event );
# Create a textbuffer to contain that string
my $textbuffer = Gtk2::TextBuffer->new();
$textbuffer->set_text('yadda yadda yadda');
# Create a textview using that textbuffer
my $textview = Gtk2::TextView->new_with_buffer($textbuffer);
# Add the textview to a scrolledwindow
my $scrolledwindow = Gtk2::ScrolledWindow->new( undef, undef );
$scrolledwindow->add($textview);
$vbox->pack_start($scrolledwindow, 1, 1, 0 );
$window->show_all();
Gtk2->main;
#####################################
sub delete_event {
Gtk2->main_quit;
return FALSE;
}
#######################################
__END__
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.