Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

(pySide2) how does one get Screen size minus the taskbar?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
absoluteKelvin
161 Views, 2 Replies

(pySide2) how does one get Screen size minus the taskbar?

maya 2023

from PySide2.QtWidgets import QApplication
from PySide2.QtGui import QScreen
screensize = QScreen.availableGeometry(QApplication.primaryScreen()).size().toTuple()

from testing and studying other peoples scripts. I figured out how to get the size of the primary screen. But would like to get the screen size without the windows taskbar.

https://www.artstation.com/kelvintam
2 REPLIES 2
Message 2 of 3

I've never had to do this, so I can't vouch for its accuracy, but if you look at the docs for QScreen.availableGeometry it says:

 

 

This property holds the screen’s available geometry in pixels.

The available geometry is the geometry excluding window manager 
reserved areas such as task bars and system menus.

 

 

Which sounds like it should already be giving you the thing you want. 

 

Just out of interest, why do you want this size? Maybe there's a different or more appropriate way to get the ultimate data you need?

 

EDIT: - OK, I just tried this code on Maya 2022 and it worked perfectly, I got (1920, 1160) back, which is the exact size of my desktop on Monitor 1, minus the Windows taskbar height...

Message 3 of 3

Ah yes silly me, I didn't actually verify the pixels. I was trying to resize a window so that it won't be cut off. It threw me off since my window wasn't aligned to the top of the screen, as it got cut off near the bottom when resizing.

 

TuEsjxS8oFcopy.png

 

https://www.artstation.com/kelvintam

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report