PDA

View Full Version : understanding PyGtk



baskar007
October 26th, 2009, 06:53 PM
I am pretty new to Gtk.I have read many examples, but still i can't figure out looping method.

i want to show the realtime changes of local variables on GUI.

for examble:
i have a variable named SIZE. SIZE="slim"
this SIZE variable will change it's value every 1sec.

how can i show it's changes in GUI using pyGtk?

i think this a chilly question for you. But i little more confused :(with PyGTK, i need some guide so please help me.

SledgeHammer_999
October 26th, 2009, 09:09 PM
(I don't know python)

Use a GtkLabel. And then update the text it shows with gtklabel.set_label(SIZE)

nvteighen
October 26th, 2009, 10:28 PM
This is a fairly complex issue... A way to solve it is to use the Model View Controller design in order to simulate a "real time" update by redrawing the desired label on demand... to do that in a sane way takes a lot of knowledge...

Another way is to use multiple threads, which is also a difficult thing to master and I guess that interfering with GTK+'s own multithreading may also be complicated...

Conclusion: This has nothing to do with "understanding GTK+", but with the difficult topic of how to deal with non-sequential instructions in computing.

EndOn9
October 27th, 2009, 06:06 PM
Maybe this (http://www.pygtk.org/pygtk2reference/gobject-functions.html#function-gobject--timeout-add) might prove helpful :)

baskar007
October 28th, 2009, 07:54 PM
Maybe this (http://www.pygtk.org/pygtk2reference/gobject-functions.html#function-gobject--timeout-add) might prove helpful :)
thank you