Re: Example for doing gtk draw_string on a drawing area (newbie)



Hello Cameron,

I would recommend that you use the Gnome::Canvas instead for creating
your graphics. It is much simpler than to use the primitive gdk 
functions directly on a window. Since you are using Gtk-Perl-0.7008 then
see the Gnome/samples/canvas.pl directory for examples of how to 
create the various canvas objects. For a more complete description of the
canvas, see the GGAD book.

Regards,
Dov

On Tue, May 13, 2003 at 09:10:56PM +1200, Cameron Kerr wrote:
Hi, I'm new to Perl, and to GTK programming.

I'm making an SNMP graphing application, and have so far got it to poll,
draw, and update the display.

Now I need to draw some labels and values on the axes.

I'm fairly certain I need to use draw_string, but I don't know what the
font argument is supposed to be.

So far, the appropriate lines say

        my $font_gc = new Gtk::Gdk::GC ( $widget->window );
        my $fontcolor = $widget->window->get_colormap->color_alloc(
                        { red => 0, green => 0, blue => 0 } );

        $graph->draw_string( $font_gc, 'what goes here?', 
                      20, 20, "Hello, World" );

According to the error message, its supposed to be of type
Gtk::Gdk::Font, but how do I specify it?

Thanks

-- 
Cameron Kerr
Email:   cameron kerr paradise net nz
Website: http://nzgeeks.org/cameron/

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

-- 
                                                        ___   ___
                                                      /  o  \   o \
Dov Grobgeld                                         ( o  o  ) o   |
The Weizmann Institute of Science, Israel             \  o  /o  o /
"Where the tree of wisdom carries oranges"              | |   | |
                                                       _| |_ _| |_
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]