Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Python Tkinter中的Spinbox中包含变量列表_Python_List_Tkinter - Fatal编程技术网

如何在Python Tkinter中的Spinbox中包含变量列表

如何在Python Tkinter中的Spinbox中包含变量列表,python,list,tkinter,Python,List,Tkinter,我试图在Python中使用Tkinter创建一个包含月份天数(字符串)的旋转框,但只知道如何在一个范围内包含数字。e、 g从=1900到=2016 如何在旋转框中包含字符串列表?我需要创建一个实际的列表吗? 具体代码如下: w = StringVar() Spinbox(root, from_ = 1900, to = 2017, textvariable = w, width = 5).place(x = 315, y = 60) 只需将字符串列表传递给spinbox的值选项: from t

我试图在Python中使用Tkinter创建一个包含月份天数(字符串)的旋转框,但只知道如何在一个范围内包含数字。e、 g<代码>从=1900到=2016

如何在旋转框中包含字符串列表?我需要创建一个实际的列表吗?

具体代码如下:

w = StringVar()
Spinbox(root, from_ = 1900, to = 2017, textvariable = w, width = 5).place(x = 315, y = 60)

只需将字符串列表传递给spinbox的
选项:

from tkinter import Tk, Spinbox
root = Tk()
months = ["January", "February", "March"]
spinbox = Spinbox(root, values=months)
spinbox.pack()
root.mainloop()