Want to show images one by one
- From: Rocky Marrone <rocky marrone gmail com>
- To: gtkmm-list gnome org
- Subject: Want to show images one by one
- Date: Thu, 26 Feb 2009 12:45:59 +0530
Hi All,
First of all thanks for all of you in advance....
I want to show 50 images one by one with the help of Gtk::Fixed...
What i am doing is that creating something on Gtk::Fixed and creating a thread and in the thread function i want to display 50 images one by one infinitly.
But when i am putiing the images one by one with sleep i am getting warning and GTK Critical errors like
(simulator:4388): Gtk-WARNING **: Can't set a parent on widget which has a parent
want to put the images
(simulator:4388): Gtk-WARNING **: Can't set a parent on widget which has a parent
(simulator:4388): Gtk-CRITICAL **: gtk_widget_destroy: assertion `GTK_IS_WIDGET (widget)' failed
I am also attaching the source code of it
// TODO // This is very important without this the project won't be that affective but in know it will work
// This portion have to be completed in a sort span of time.
// How to update the rectangular region in gtkmm is the problem
// Finish time ASAP
void Board::set_animate_image(void) {
std::cout << "entering the set_animate_image " << std::endl;
int counter = 0;
while (1) {
if (counter > 49) {
counter = 0;
}
std::cout << "want to put the images" << std::endl;
m_base.put(*Gtk::manage(m_background_images[counter]), BASE_BACKGROUND_ANIMATION_X_POS + counter, BASE_BACKGROUND_ANIMATION_Y_POS + counter);
m_background_images[counter]->show();
// gdk_threads_enter();
// m_background_images[counter]->show();
// Gdk::Rectangle rect;// = m_ptr_base_window->get_allocation();
// rect.set_x(350);
// rect.set_y(300);
// rect.set_width(480);
// rect.set_height(270);
// m_ptr_base_window->invalidate_rect(rect, false);
// std::cout << rect.get_x() << " " << rect.get_y() << " " << rect.get_width() << std::endl;
// gdk_flush();
// ++counter;
// gdk_threads_leave();
sleep(1);
}
}
// Initalize the board animation
void Board::initialize_board_animation(void) {
char str_file[100];
for (int counter = 49; counter >= 0; --counter) {
memset(str_file, 0, 100);
int temp_file_name = counter * 8;
if (temp_file_name > 99) {
sprintf(str_file ,"../images/image/test0%d.bmp", temp_file_name);
} else if (temp_file_name > 9 && temp_file_name < 100 ) {
sprintf(str_file ,"../images/image/test00%d.bmp", temp_file_name);
} else if (temp_file_name < 10) {
sprintf(str_file ,"../images/image/test000%d.bmp", temp_file_name);
} else {
sprintf(str_file ,"../images/image/test0000.bmp");
}
m_background_images[counter] = new Gtk::Image(str_file);
std::cout << str_file << std::endl;
}
m_ptr_thread = Glib::Thread::create(sigc::mem_fun(*this, &Board::set_animate_image), true);
}
Please help me that how can i achieve to display the 50 images one by one ....
Thnx & Best Reagards
Rocky Marrone
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]