[英]how to get width and height of monitor in python glfw
幾個月前我在 Java 中使用了 glfw,我清楚地記得
GLFWVidMode vidmode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
GLFW.glfwSetWindowPos(window,vidmode.width()/2-width/2,vidmode.height()/2-height/2)
can be used to position your window in the center but when i try to do that in python in a similar way (considering that rest of the code for glfw in python is purely identical to java) it doent work becuase the object vidmode has no method高度或寬度....如何恢復顯示器的寬度和高度
您可以從size
屬性中獲取大小:
monitor = glfwGetPrimaryMonitor()
vidmode = glfwGetVideoMode(monitor)
v_width = vidmode.size.width
v_height = vidmode.size.height
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.