PyBrite/pybrite.py
2017-01-12 12:11:02 +01:00

51 lines
721 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
Tkinter GUI to adjust xrandr brightness setting on the fly
"""
from tkinter import *
import os
c = 70
d = 5
def setb():
lab.config(text = "%u%%" % c)
os.system("xrandr --output DFP2 --brightness %f" % (c / 100))
def m():
global c
if c > 0:
c -= d
setb()
def p():
global c
if c < 100:
c += d
setb()
master = Tk()
f1 = Frame(master)
f1.pack(side = TOP, fill = Y)
f2 = Frame(master)
f2.pack(side = BOTTOM, fill = Y)
minus_but = Button(f1, text = " ", command = m)
minus_but.pack(side = LEFT)
plus_but = Button(f1, text = " + ", command = p)
plus_but.pack(side = RIGHT)
lab = Label(f2, text = '')
lab.pack(side = TOP)
setb()
master.title("PyBright")
mainloop()