Screen resolution again

David Lees debl2nononespammyyy at bellatlantic.net
Sun Jun 9 13:59:28 EDT 2002


I am still trying to figure out how to automatically create a canvas
that is sized according to the screen resolution using tkinter on a
win95 box and python 2.2.1.  The hack below sort of does that, but I
would appreciate advice, suggestions or pointers to a url on how to do
it correctly.  Note that I create an extra canvas get the root height
and windth.

david lees
-------------------

from Tkinter import *
root = Tk()

root.title('Drawing')
canvas = Canvas(root,width=20,height=20,bg='white')
canvas.pack()

h = canvas.winfo_vrootheight()
w = canvas.winfo_vrootwidth()


print w,h
canvas2 = Canvas(root,width=w-30,height=h-30,bg='white')
canvas2.pack()

root.mainloop()



More information about the Python-list mailing list