Detecting screen resolution using Tkinter

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


Arild Hansen <arildh at stud.cs.uit.no> 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.
 
Yours,
Alexander

-- 
Alexander Schliep                    schliep at zpr.uni-koeln.de
ZPR/ZAIK                             Tel: +49-221-470-6040 (w) 
University of Cologne                FAX: +49-221-470-5160
Weyertal 80                          http://www.zpr.uni-koeln.de/~schliep
50931 Cologne, Germany               



More information about the Python-list mailing list