问题
I have two monitors on a new Ubuntu 14.02 machine. One monitor is 1024X768 VGA. The second monitor is 1920X1080 HDMI No matter what I do root.winfo_screenwidth() reports 2944 (The sum of both monitors) (If I stack the monitors then winfo_screenheight reports the sum of heights)
Of course I did most of the development of my software on Windows where it worked fine (with two monitors)
With only one monitor plugged in to the Ubuntu machine, it works fine.
This all fails very badly with:
import Tkinter
root=Tkinter.Tk()
root.attributes('-fullscreen',True)
root.update()
print root.winfo_screenwidth()
print root.winfo_screenheight()
When Tkinter creates the root window with the -fullscreen attribute, it creates a window that it thinks is way wider than it is. So on my windows machine (with two monitors) root.winfo_screenwidth() is 1680. But on my Ubuntu machine (with two monitors) root.winfo_screenwidth() is 2944.
Help.....
回答1:
Once again the difference between Windows and X I guess.
On Windows: root.winfo_screenwidth() equals the current monitor width.
On X: root.winfo_screenwidth() equals the width of the all monitors. (Props to @tripleee)
root.winfo_width() equals the width of the current display on both X and windows.
Is there a good reference for the diff between windows and X?
来源:https://stackoverflow.com/questions/24377988/tkinter-on-ubuntu-14-02-reports-width-as-sum-of-both-monitors