PR
Calendar
Keyword Search
Category
Free Space
import subprocess
def command2pipe(cmd1, cmd2):
p = subprocess.Popen(cmd1, stdout=subprocess.PIPE)
p2 = subprocess.Popen(cmd2, stdin=p.stdout, stdout=subprocess.PIPE)
p.stdout.close()
first_line, rest_lines = p2.communicate()
return(first_line, rest_lines)
if __name__ == '__main__':
cmd1 = ['xrandr']
cmd2 = ['grep', '*']
resolution_string, junk = command2pipe(cmd1, cmd2)
resolution = resolution_string.split()[0]
width, height = resolution.split('x')
mesg = "Resolution: %sx%s" % (width, height)
print(mesg)
from win32api import GetSystemMetrics
print "Width =", GetSystemMetrics(0)
print "Height =", GetSystemMetrics(1)
import ctypes
user32 = ctypes.windll.user32
screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
pip install screeninfo
from screeninfo import get_monitors
for m in get_monitors():
print(str(m))
janome を使った Python プログラムを pyi… 2024.04.08
Tkinter でも、見た目のよい GUI を作れる 2024.02.25
Chromecast を Python で制御する 2016.01.10