faqts : Computers : Programming : Languages : Python : Tkinter

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 1 people (100%) answered Yes
Recently 1 of 1 people (100%) answered Yes

Entry

How do i access multiple screens in tkinter? My GUI needs to be on 2 monitors.

Feb 14th, 2005 21:45
Martin Franklin, nik heger,


The Tk Toplevel widget can take a screen option when you create it's 
instance.

Example:

# left hand screen
top1 = Toplevel(root, screen=":0")

# right hand screen
top2 = Toplevel(root, screen=":1")

(this is untested as I only have one screen...)

If both screens are really only one screen (not sure how to describe 
that)  then setting the geometry on the toplevel instance would work 
too.


Example:

top1 = Toplevel(root)

# top left corner of 'whole' screen
top1.geometry("+1+1")

# top right corner of 'whole' screen
top1.geometry("-1+1")

# bottom left corner of 'whole' screen
top1.geometry("+1-1")

# bottom right corner of 'whole' screen
top1.geometry("-1-1")

These can be added to the normal geometry size options like so:

# top right and full screen?? (if running 1024x768!)
top1.geometry("1024x768+1+1")


If you need to find out how big your screen is:

top1.winfo_vrootwidth()
top1.winfo_vrootheight()