Python 经济学的应用。我的原始申请

Python 经济学的应用。我的原始申请,python,tkinter,python-3.6,Python,Tkinter,Python 3.6,当我运行我的程序时,它给了我一个错误,说我在top.geometry(x,y)中传递了3个参数,而我只传递了两个参数 I've tried using "foo" and that made it worse. What I am trying to do is create a tkinter application that will calculate the amount of money adjusted for inflation at a future year. #!/

当我运行我的程序时,它给了我一个错误,说我在top.geometry(x,y)中传递了3个参数,而我只传递了两个参数

I've tried using "foo" and that made it worse. What I am trying to do is create a tkinter application that will calculate the amount of money adjusted for inflation at a future year.

    #!/usr/bin/env python3
    import tkinter as tk
    from tkinter import *
    import math
    from math import *
    import matplotlib 
    from matplotlib import *
    from pylab import plot, show

    "set window geometry variables"
    (x,y) = (1650,1100)
    "Define Empty List"
    x_Data = []
    y_Data = []
    "Create Window and Define it's Size"
    top = tk.Tk()
    top.title("Inflation Adjusted Calculator")
    top.geometry(x,y)




Traceback (most recent call last):
  File "/home/jacob/Documents/Python Programs/Inflation_Calculator_Program.py", line 17, in <module>
    top.geometry(x,y)
TypeError: wm_geometry() takes from 1 to 2 positional arguments but 3 were given
我试过用“foo”,结果更糟了。我想做的是创建一个tkinter应用程序,它将计算未来一年的通货膨胀调整后的货币金额。
#!/usr/bin/env蟒蛇3
将tkinter作为tk导入
从tkinter进口*
输入数学
从数学导入*
导入matplotlib
从matplotlib导入*
从pylab导入绘图,显示
“设置窗口几何体变量”
(x,y)=(16501100)
“定义空列表”
x_数据=[]
y_数据=[]
“创建窗口并定义其大小”
top=tk.tk()
顶部标题(“经通胀调整的计算器”)
顶部。几何图形(x,y)
回溯(最近一次呼叫最后一次):
文件“/home/jacob/Documents/Python Programs/Inflation\u Calculator\u Program.py”,第17行,在
顶部。几何图形(x,y)
TypeError:wm_geometry()接受1到2个位置参数,但给出了3个

几何体的定义如下

将几何图形设置为形式为=宽度x高+x+y的新几何图形。返回 如果未给出,则为当前值

因此,要将窗口的值设置为1650x1100,只需将其传递到
geometry
方法中即可

import tkinter as tk
from tkinter import *
import math
from math import *
import matplotlib 
from matplotlib import *
from pylab import plot, show

# Define Empty List
x_Data = []
y_Data = []
# Create Window and Define it's Size
top = tk.Tk()
top.title("Inflation Adjusted Calculator")
top.geometry('1650x1100')
mainloop() 

几何体的定义如下

将几何图形设置为形式为=宽度x高+x+y的新几何图形。返回 如果未给出,则为当前值

因此,要将窗口的值设置为1650x1100,只需将其传递到
geometry
方法中即可

import tkinter as tk
from tkinter import *
import math
from math import *
import matplotlib 
from matplotlib import *
from pylab import plot, show

# Define Empty List
x_Data = []
y_Data = []
# Create Window and Define it's Size
top = tk.Tk()
top.title("Inflation Adjusted Calculator")
top.geometry('1650x1100')
mainloop() 

你为什么要在引号中写注释?
geometry
采用
str
top.geometry(f'{x}x{y}')
,那么你就不必更改代码的其余部分了。你为什么要用引号来写注释呢?
geometry
使用
str
top.geometry(f'{x}x{y}')
,那么你就不必更改代码的其余部分了。