You are not logged in.

#1 2013-08-15 18:48:43

insane_alien
Member
Registered: 2007-11-19
Posts: 39

[SOLVED] Python Gauges?

Hi,

Using python (3.3.2) I've developed a small monitor script that takes sensor readings (Temperature, Pressure etc.) dumps the information to a log and has a CLI display of the current values that looks like this:

Temperature: 200*C ***Warning! High!***
Pressure: 1.2 bar !!!Alert!!!Low!!!

I included the warnings just to show what the alert system is like. A warning means something is getting close to having a bad impact and it should be fixed. An alert means it IS having a bad impact and you'll need to start all over again.

Until now, the text output(which is coloured for warnings) has been fine as it's only me who's been working on this project but it will eventually end up being used by others and reading a text interface at a glance isn't really going to happen.

I'm thinking of making a set of digital gauges similar to the analogue ones your get (the people this is intended for are very familiar with them) with a digital read out below for accuracy. I'm thiking something similar to this

I've never done GUI before (but i've been meaning to get round to it) and was wondering if there's maybe a tutorial or library I should be looking at for this. I've got maybe a year to develop this so time pressure isn't a factor yet.

Last edited by insane_alien (2013-08-18 09:52:40)

Offline

#2 2013-08-16 06:05:56

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,012

Re: [SOLVED] Python Gauges?

conky uses lua and so does awesomewm so maybe check out using that.
Lua in Python


You're just jealous because the voices only talk to me.

Offline

#3 2013-08-16 11:42:05

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 3,709

Re: [SOLVED] Python Gauges?

Easy to do with QT/GTK


Evil #archlinux@freenode channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#4 2013-08-16 11:52:20

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,372
Website

Re: [SOLVED] Python Gauges?

I'd also suggest cairo which has a good python API.

Cairo would be required as a dependency of either gtk or qt, and unless you'd be adding textboxes, dropdown selection tools, or other toolkit specific stuff, the toolkit itself probably wouldn't be needed, just the 2d drawing ability of cairo.

EDIT: I suppose I neglected the actual window creation.  Cairo needs a target surface.  So you'd need at least xlib/xcb for creating a window.  In C this is trivial, but I don't know much about python - I wouldn't be surprised if the gtk API was easier than a direct python-xlib window creation.

Last edited by Trilby (2013-08-16 11:53:54)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Online

#5 2013-08-16 17:46:31

nomorewindows
Member
Registered: 2010-04-03
Posts: 2,943

Re: [SOLVED] Python Gauges?

moetunes wrote:

conky uses lua and so does awesomewm so maybe check out using that.
Lua in Python

I just have many read-outs in awesome on my wibox.  Drawing guages takes more cpu and memory.  Especially if you want constant read-outs.  Nothing wrong with having a thin pseudotext line as long as you know what it all means.  Xfce has some of these gauges available with plugins.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#6 2013-08-18 09:52:24

insane_alien
Member
Registered: 2007-11-19
Posts: 39

Re: [SOLVED] Python Gauges?

Cairo/qt looks to be what i'm looking for. Time to start learning how to do a basic graphical display.

LUA in python seems a bit cludgy for me (Yo dawg, we heard you like scripting languages...) and it begs the question: "how do i make gauges in LUA?" as I know zero LUA code I think i'll give it a miss.

Offline

Board footer

Powered by FluxBB