python - 经济学应用。我的原始申请
问题描述
当我运行程序时,我的程序给了我一个错误,说当我只传递了两个参数时,我将 3 个参数传递给了 top.geometry(x,y)。
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
解决方案
的定义geometry
如下
将几何图形设置为 =widthxheight+x+y 形式的 NEWGEOMETRY。如果给出 None,则返回当前值。
因此,要将窗口的值设置为 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()
推荐阅读
- android - Android 11+ 在前台服务 (FLP) 中对后台位置的请求限制是什么?
- python - Python拆分SQL语句
- javascript - 更改属性的值
- javascript - mongodb在写之前关闭连接
- c# - 几天的 C# 计时器
- typescript - 为什么这个 TS 类型被识别为命名空间?
- c - 在调用后使用 getline( &buff, &len, f ) 的 len 参数进行比较会导致它在下次调用时崩溃
- fortran - 使用 ifort 构建可执行共享库
- apache-kafka - 生成消息后从 Kafka 代理获得响应
- google-drive-api - 云端硬盘 API 更新