fjs
fjs

Reputation: 21

How do I print values read from an adc to a GTK+ label?

I am working on a Graphical User Interface to display voltage values being read from an mcp3208 chip. I am using a raspberry pi and PyGtk to make the GUI. I already have the python code to read in the data and display it on the terminal window. Ive started working on a GUI to display the values on a label within the main gui window. However, i can only update the values when i press a button on the gui. I want to make the values update automatically on the label without having to press a button or wait on any other signal. Is there a way of displaying the voltage values on the gtk window instead of the terminal window?

Upvotes: 2

Views: 111

Answers (1)

theGtknerd
theGtknerd

Reputation: 3763

Use GLib.timeout_add(). Read the documentation here. You can use this to update the label every second or whatever time you set the timeout to.

Upvotes: 1

Related Questions