GithubHelp home page GithubHelp logo

Comments (3)

hannesdelbeke avatar hannesdelbeke commented on June 14, 2024

see private note "Blender window size"

import ctypes
from bqt.blender_applications.win32_blender_application import get_process_hwnds
from ctypes import wintypes  
user32 = ctypes.windll.user32

process_windows = get_process_hwnds()
for win in process_windows:  
	# get height and width  
	rect = wintypes.RECT()  
	user32.GetWindowRect(win.hwnd, ctypes.byref(rect))  
	height = rect.bottom - rect.top  
	width = rect.right - rect.left  
	print(height, width)
  
import bpy  
print("height bpy", bpy.context.window_manager.windows[0].height, "width", bpy.context.window_manager.windows[0].width)
type height width
main window user32 2065 2124
main window bpy 2009 2102
main window diff 56 22

when qt wrapped window is 0 height. bpy returns 0
but qt returns 56 height. likely the title bar height
measure with powertoys returns 28 pixels height
windows, 150% scale on 3840 x 2160px

from bqt.

hannesdelbeke avatar hannesdelbeke commented on June 14, 2024
  • also window moves position

from bqt.

hannesdelbeke avatar hannesdelbeke commented on June 14, 2024

turns out we didnt need the fancy ctypes stuff. we can just get size and pos from the blender window with bpy
works on all OS with no extra effort for us

from bqt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.