另一个方法值中减去一个方法值

另一个方法值中减去一个方法值

本文介绍了如何从python中的另一个方法值中减去一个方法值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图从另一个方法值中减去一个方法值,但即使我使用变量,它也会给我一个错误.

I've being trying to subtract a method value from another method value but it gives me a an error even when I use variables.

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

推荐答案

您正在尝试减去两个函数.您想减去调用函数的结果.试试这个:

You're trying to subtract two functions. You want to subtract the results of calling the functions. Try this:

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

这篇关于如何从python中的另一个方法值中减去一个方法值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 15:58