Friday, November 13, 2009

GTK - get display resolution

Sometime is need to get the display resolution.
This python code show how to do it:
>>> import gtk
>>> dgd=gtk.gdk.display_get_default()
>>> gsd=dgd.get_default_screen()
>>> height=gsd.get_height()
>>> width=gsd.get_width()
>>> print "height=",height,"width=",width
height= 1024 width= 1280

Quite simply ...

2 comments:

  1. Nice to find a fellow Romanian python-er. heck, I am just a humble "newby".

    Regards,
    Victor

    ReplyDelete
  2. Thank you for your good thoughts.
    Regards.

    ReplyDelete