too narrow (1 pixel width) png image on Canvas in Box in Window
- From: John Mann <johnmann31416 yahoo com>
- To: gnome-list gnome org
- Subject: too narrow (1 pixel width) png image on Canvas in Box in Window
- Date: Thu May 29 23:11:01 2003
Hello all. I'm attempting to put a Canvas into a Box
into a Window, with the Canvas holding a png image,
but the window when displayed shows just a narrow
vertical line 1 pixel wide centered left to right.
Thanks for any help. BTW, if this request for
debugging help is not appropriate for this list,
please let me know that and why...
John Mann
here's the code;
#include <gtk/gtk.h>
#include <gnome.h>
GtkWidget *window;
GtkWidget *box;
GtkWidget *canvas;
GnomeCanvasGroup *group;
GnomeCanvasItem *arrow;
GdkPixbuf *arrowPixbuf;
GError **error;
void CloseTheApp(GtkWidget *window, gpointer data) {
gtk_main_quit();
}
gint main(gint argc, gchar *argv[]) {
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 200,
200);
gtk_container_set_border_width(GTK_CONTAINER(window),
5);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(CloseTheApp), NULL);
gtk_widget_push_visual(gdk_rgb_get_visual());
gtk_widget_push_colormap(gdk_rgb_get_cmap());
canvas = gnome_canvas_new();
gtk_widget_pop_colormap();
gtk_widget_pop_visual();
group = gnome_canvas_root(GNOME_CANVAS(canvas));
arrowPixbuf =
gdk_pixbuf_new_from_file("redArrow.png", error);
arrow = gnome_canvas_item_new(group,
gnome_canvas_pixbuf_get_type(), "pixbuf",
arrowPixbuf, NULL);
gdk_pixbuf_unref(arrowPixbuf);
box = gtk_hbox_new(TRUE, 5);
gtk_box_pack_start(GTK_BOX(box), canvas, TRUE,
FALSE, 10);
gtk_container_add(GTK_CONTAINER(window), box);
gtk_window_move(GTK_WINDOW(window), 500, 500);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
=====
"I'd rather be debugging...." - Anon
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]