Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, all. I am very new to GTK+ 2.0. I just started to use it to build a very simple GUI for my robot under Ubuntu 7.10. I am trying ...
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    1

    GTK+ dynamic text display.

    Hi, all.
    I am very new to GTK+ 2.0. I just started to use it to build a very simple GUI for my robot under Ubuntu 7.10. I am trying to get the GTK+ to display my robot's sensors data at certain time intervals. Right now, I am using gtk_entry_get_text() and it can only displays once after the GUI is launched and the program waits at gtk_main().

    I tried to create a timer handler to update the sensor data at 5Hz rate or even use another thread to do it, but the text won't change. It is always showing the very first text displayed when GUI is launched.

    As I am very new to this GUI and do not wish to spend too much time in complicated GUI design as it is not my focus, is there a simple solution to dynamic numeric data display?

    Appreciate any help and advice. Thanks.

    Regards
    Ken

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    This should be posted to either the X-Windows or Programming forum. In any case, we would need an example of your code to say what the problem might be. Remember that GTK is event-driven. If you don't provide an event to your GTK program that triggers an update callback, then it won't show the changes on the screen.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,096
    Quote Originally Posted by Rubberman View Post
    This should be posted to either the X-Windows or Programming forum.
    ...thread moved to more appropriate forum.
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  4. #4
    Linux Newbie tetsujin's Avatar
    Join Date
    Oct 2008
    Posts
    115
    Quote Originally Posted by thoeeng View Post
    Hi, all.
    I am very new to GTK+ 2.0. I just started to use it to build a very simple GUI for my robot under Ubuntu 7.10. I am trying to get the GTK+ to display my robot's sensors data at certain time intervals. Right now, I am using gtk_entry_get_text() and it can only displays once after the GUI is launched and the program waits at gtk_main().

    I tried to create a timer handler to update the sensor data at 5Hz rate or even use another thread to do it, but the text won't change. It is always showing the very first text displayed when GUI is launched.
    I am fairly new to GTK myself - and I don't know the exact answer to your question... but here is what I can tell you...

    I'm not sure how you're using gtk_entry_get_text(), first off - are you using it to retrieve the pointer to the widget's internal text storage, and then store the new text there? If so, I think you're not supposed to do that. Try gtk_entry_set_text() instead... From what I can tell, that should be sufficient. If not, then you may have to call gtk_widget_show() to get the widget to redraw...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...