Data-Shapes Height relative to Screen Resolution

is it possible to pull the current screen resolution into Dynamo? I’d like to set the UI from Data-Shapes relative to the screen resolution so that it fits on lower resolution screens and so I can show more on higher resolution screens.

Hi @Greg_McDowell ,
this is a good idea. At some point I added somehting to do this within the node but it failed to work in too many cases so I deleted it.
Here’s the code I used :

import sys
pyt_path = r'C:\\Program Files (x86)\\IronPython 2.7\\Lib'
sys.path.append(pyt_path)
import ctypes
user32 = ctypes.windll.user32


OUT = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
2 Likes

What caused it to fail (if you know)?

It never failed for me :slight_smile: I just kept getting messages from people saying the forms were messed up. I wanted to investigate more but never really did …

How about using the Screen class from Windows.Forms?
https://msdn.microsoft.com/en-us/library/e8xzhd15.aspx

I haven’t had a chance to work with this yet but, if I’m shooting for an ideal state, it would be the vertical resolution from the top of the model window which is where Data-Shapes places the form initially. I’ll probably use a percentage of the resolution for now.

Thanks again.