2013-12-19 37 views
0

我一直試圖從另一個方法值中減去一個方法值,但即使在我使用變量時它也會給我一個錯誤。如何從python中的另一個方法值中減去方法值?

from tkinter import * 
statistics = Tk() 
screenwidth = statistics.winfo_screenwidth 
windowwidth = statistics.winfo_width 
distance = screenwidth - windowwidth 
statistics.geometry(+distance+'0') 

回答

2

您正試圖減去兩個函數。你想減去調用函數的結果。試試這個:

from Tkinter import * 
statistics = Tk() 
screenwidth = statistics.winfo_screenwidth() 
windowwidth = statistics.winfo_width() 
distance = screenwidth - windowwidth 
statistics.geometry('+%s+0' % distance) 
+0

當距離發生時會發生錯誤。 – user3102599

+0

是否有任何其他方式讓窗口在任何電腦的右上角。 – user3102599

相關問題