Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

การตรวจจับความพร้อมของหน้าจอแสดงผลอัตโนมัติด้วย Matplotlib


ขั้นตอน

  • นำเข้าโมดูล os
  • ใช้ os.environ["DISPLAY"] เพื่อดูหน้าจอที่พร้อมใช้งาน

ตัวอย่างโค้ด

import os
env = os.environ["DISPLAY"]
print("Automatic detected display availability: ", env)

ผลลัพธ์

Automatic detected display availability: 0