Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Brightness Tweak/Application

  1. #11
    Join Date
    Jun 2011
    Location
    United Kingdom
    Beans
    Hidden!
    Distro
    Lubuntu Development Release

    Re: Brightness Tweak/Application

    Perhaps this will help:

    Code:
    import subprocess
    
    #Run the xrandr command within a shell, redirecting stdout.
    result = subprocess.Popen("xrandr --current --verbose | grep Brightness | sed 's/[^0-9.]*//g'", shell=True, stdout=subprocess.PIPE)
    
    #Print the first line of stdout, as a floating-point number 
    print(float(result.stdout.read().split()[0]))

  2. #12
    Join Date
    Nov 2007
    Location
    Sitka Alaska
    Beans
    94
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Brightness Tweak/Application

    Quote Originally Posted by MG&TL View Post
    Perhaps this will help:

    Code:
    import subprocess
    
    #Run the xrandr command within a shell, redirecting stdout.
    result = subprocess.Popen("xrandr --current --verbose | grep Brightness | sed 's/[^0-9.]*//g'", shell=True, stdout=subprocess.PIPE)
    
    #Print the first line of stdout, as a floating-point number 
    print(float(result.stdout.read().split()[0]))
    I think I might just love you lol
    Ubuntu Server User - OSX and Windows Desktop

  3. #13
    Join Date
    Jun 2011
    Location
    United Kingdom
    Beans
    Hidden!
    Distro
    Lubuntu Development Release

    Re: Brightness Tweak/Application

    Quote Originally Posted by eenofonn View Post
    I think I might just love you lol
    That's a good one.

    Let me know how you get on.

  4. #14
    Join Date
    Nov 2007
    Location
    Sitka Alaska
    Beans
    94
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Brightness Tweak/Application

    Quote Originally Posted by MG&TL View Post
    That's a good one.

    Let me know how you get on.
    I've had my kids all weekend and I've started looking at it but I think it's best if I look at some tutorials before I start messing around with python again. Having a hard time wrapping my head around how to call variables or define them (whatever it's called) I will let you know when I get back to trying it


    EDIT- I found what I was doing wrong!!! gedit wasn't showing the spacing correctly, I opened it up in nano and it was obvious what I was doing wrong. I now have the completed code working for my machine but I want to be able to modify it for others who are using a different output so I'm going to find a way to grab that too
    Last edited by eenofonn; January 21st, 2013 at 07:58 AM.
    Ubuntu Server User - OSX and Windows Desktop

  5. #15
    Join Date
    Jun 2011
    Location
    United Kingdom
    Beans
    Hidden!
    Distro
    Lubuntu Development Release

    Re: Brightness Tweak/Application

    I've had my kids all weekend and I've started looking at it but I think it's best if I look at some tutorials before I start messing around with python again. Having a hard time wrapping my head around how to call variables or define them (whatever it's called) I will let you know when I get back to trying it
    Probably a good idea, but python is designed to be hackable for beginners, so you should be okay.

    EDIT- I found what I was doing wrong!!! gedit wasn't showing the spacing correctly, I opened it up in nano and it was obvious what I was doing wrong. I now have the completed code working for my machine but I want to be able to modify it for others who are using a different output so I'm going to find a way to grab that too
    Awesome! Yup, python's indents are a bit of a gotcha. Good luck with that!

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

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