Re: Question: Making a Gtk+ application interacts with octave
- From: Muthiah Annamalai <dearestchum yahoo co in>
- To: gtk-app-devel-list gnome org, "amartinez atc ugr es" <amartinez atc ugr es>, Alem Dain <alem dain gmail com>
- Cc:
- Subject: Re: Question: Making a Gtk+ application interacts with octave
- Date: Tue, 19 Jul 2005 12:50:07 -0700 (PDT)
Hello!
You can use this code to show a image, in a persistent
way.
---------------------------------------------
#! /usr/bin/octave -q
% (C) July 2005, Muthiah Annamalai
<gnumuthu-at-users-nospam-sf-spamno-net>
%
% Ensure:
%
%matrix you pass to gtk_imshow_set() has only
% elements with normalized to value [0,1].
%
%size of window must be set explicitly, to greater
%than that of your ImageShow[drawing area] widget
%
%get the ImShow widget using, gtk_imshow_get_da(x),
%and use this as real widget handler. this interface
%will change in future.
disp('Simple GTK+ Image Show example');
x=0
function timeout()
global x
disp('Timeout')
gtk_imshow_set(x,rand(256));
gtk_widget_queue_draw(gtk_imshow_get_da(x));
end
function main()
global x;
gtk()
gtk_init()
w=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtkimshow()
disp('ImShow Creating')
x=gtk_imshow_new(200,200);
disp('ImShow Created')
img=rand(256);
gtk_imshow_set(x,img);
gtk_timeout_add(2000,"timeout"); %keep changing
images every 2 seconds.
g_signal_connect(w,"destroy","gtk_main_quit");
gtk_container_add(w,gtk_imshow_get_da(x));
gtk_window_set_default_size(w,300,300);
gtk_widget_show(gtk_imshow_get_da(x));
gtk_widget_show_all(w);
gtk_main();
end
main()
--------------------------------------------------
To use this program you need octave-gtk+ and
[http://sourceforge.net/projects/octave-gtk/]
the imshow.tgz package from
[http://octave-gtk.sf.net/imshow.tgz]
Ive added a screenshot here:
[http://octave-gtk.sf.net/imshow.png].
Cheers
Muthu
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]