如何从python中的另一个方法值中减去方法值?

时间:2013-12-19 14:22:59

标签: python tkinter

我正在尝试从另一个方法值中减去一个方法值,但即使我使用变量也会给我一个错误。

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

1 个答案:

答案 0 :(得分:2)

你试图减去两个函数。您想要减去调用函数的结果。试试这个:

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