Detecting screen resolution using Tkinter

Alexander Schliep schliep at Octopussy.MI.Uni-Koeln.DE
Wed Nov 8 13:21:18 CET 2000

Arild Hansen <arildh at> writes:

> I have made a GUI application under Linux RedHat 7.0, python 2.0c1 using
> Tkinter. The GUI looks extremely cool (!!) when I use a resolution 1024
> * 768, but when I run the GUI in other resolutions the GUI sucks. So, I

This seems to suggest that you did not use the layout managers (pack,
grid) which would take care of that problem and, in case your windows
are resizable, resizing of windows? Probably users choosing different
fonts for the application will also cause problems.

> would like to have the application detect the current screen resolution
> and therefore adapt itself to this. My question is: How do I detect the
> screen resolution in python? Thx for all help,

If self is a Frame then self.master.winfo_screenwidth() and
self.master.winfo_screenheight() give you the screen size,
but I would use grid or pack.

Alexander Schliep                    schliep at
ZPR/ZAIK                             Tel: +49-221-470-6040 (w) 
University of Cologne                FAX: +49-221-470-5160
Weyertal 80                
50931 Cologne, Germany               

More information about the Python-list mailing list