Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to work with the return value of grabc. If it returns #000000 then I want to take it to a=#000000. But this outputs the value in terminal. So How can I do this?

[N.B: grabc is a tool for finding out the RGB value at mouse click. Use sudo apt-get install grabc]

share|improve this question
1  
You probably want something like this: stackoverflow.com/questions/2502833/… –  Jason Conti Oct 7 '13 at 17:21
    
This question appears to be off-topic because it is a programming question and not specific to Ubuntu. –  Nathan Osman Oct 8 '13 at 2:27
    
grabc is at least linux-specific, it could be answered in a platform agnostic way, but it could also exist some way of doing the same thing (recover the RGB value at mouse click) that is Ubuntu specific. On-topic to me. –  Javier Rivera Oct 8 '13 at 7:03
add comment

1 Answer 1

I managed to find the answer. I thought I should share this,

import os

p=os.popen('grabc')

s=p.readline()

p.close()

print "a="+s

This gave me the desired result.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.