Потому что мне не нравится анализировать вывод консоли Инструмент командной строки xrandr — по крайней мере, если мне в этом нет необходимости — я хотел бы сделать это с помощью Python-XLib или аналогичного подхода Pythonic.
Это вывод xrandr для моего отображать конфигурация:
Код: Выделить всё
$ xrandr
Screen 0: minimum 320 x 200, current 2960 x 1050, maximum 8192 x 8192
DVI-0 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 473mm x 296mm
1680x1050 60.0*+
[some lines cut]
VGA-0 connected 1280x1024+1680+26 (normal left inverted right x axis y axis) 376mm x 301mm
1280x1024 60.0 + 75.0*
[some more lines cut]
Код: Выделить всё
monitors = get_monitors()
print monitors[0].width # out: 1680
print monitors[1].width # out: 1280
print monitors[0].x_position # out: 0
print monitors[1].x_position # out: 1680
Код: Выделить всё
import Xlib
import Xlib.display
display = Xlib.display.Display(':0')
print display.screen_count() # output: 1
root = display.screen().root
print root.get_geometry().width # output: 2960 -> no way to get width of single monitor?
print root.get_geometry().height # output: 1050
Неужели нет способа получить (подробную) отображаемую информацию с помощью Python без необходимости анализа вывод xrandr?
Подробнее здесь: https://stackoverflow.com/questions/870 ... -line-tool