5

Possible Duplicate:
How do I get Monitor resolution in Python?

I was wondering if there was a way to get the screen size from a python script.

Similar Questions:

Getting monitor size in python

This question tells you how to get it through pygame. Is there a way to do it with just python? I need the scripts to run on several Unix-based operating system.

Community
  • 1
  • 1
rabindo
  • 51
  • 1
  • 1
  • 2
  • Is your script a console (text mode) program, or a GUI program? How are you drawing things to the screen? If you're using a library like `curses`, then use the facilities of that library. – Greg Hewgill Jul 30 '10 at 22:15
  • I use matplotlib to graph stuff. I just want to make the figure size appropriate so that it takes up the full screen. I just need to find a way to get the screen size to make the figure the appropriate size – rabindo Jul 30 '10 at 22:18
  • One way might be to create the image with some reasonable resolution like 1280x1024, then ask whatever image viewer you're using to scale it to the actual screen size. – Greg Hewgill Jul 30 '10 at 22:21
  • seems like a dup to me. I did not see that question. I still have a question... I do have one Mac OS X machine. Where can I download/install AppKit? – rabindo Jul 30 '10 at 22:46

1 Answers1

3

I stole this from Finding the workspace size (screen size less the taskbar) using GTK

import gtk, pygtk

window = gtk.Window()
screen = window.get_screen()
print "width = " + str(screen.get_width()) + ", height = " + str(screen.get_height())

Just to let you know, if you have multiple monitors the screen's size will be all of those monitors together.

Community
  • 1
  • 1
Kevin S
  • 2,713
  • 24
  • 31